def convert_real_from_base_unit(base_value: float, base_unit: Optional[str]) -> Optional[str]:
    """Convert an floating-point value in some base unit to a human-friendly unit.

    Same as :func:`convert_int_from_base_unit`, except we have to do the math a bit differently,
    and there's a possibility that we don't find any exact divisor.

    :param base_value: value to be converted from a base unit
    :param base_unit: unit of *value*. Should be one of the base units (case sensitive):

            * For space: ``B``, ``kB``, ``MB``;
            * For time: ``ms``, ``s``, ``min``.

    :returns: :class:`str` value representing *base_value* converted from *base_unit* to the greatest
        possible human-friendly unit, or ``None`` if conversion failed.

    :Example:

        >>> convert_real_from_base_unit(5, 'ms')
        '5ms'

        >>> convert_real_from_base_unit(2.5, 'ms')
        '2500us'

        >>> convert_real_from_base_unit(4.0, '256MB')
        '1GB'

        >>> convert_real_from_base_unit(4.0, '256 MB') is None
        True
    """
    base_value_mult, base_unit = strtol(base_unit, False)
    if TYPE_CHECKING:  # pragma: no cover
        assert isinstance(base_value_mult, int)
    base_value *= base_value_mult

    result = None
    convert_tbl = get_conversion_table(base_unit)
    for unit in convert_tbl:
        value = base_value / convert_tbl[unit][base_unit]
        result = f'{value:g}{unit}'
        if value > 0 and abs((round(value) / value) - 1.0) <= 1e-8:
            break
    return result
Convert an floating-point value in some base unit to a human-friendly unit.

    Same as :func:`convert_int_from_base_unit`, except we have to do the math a bit differently,
    and there's a possibility that we don't find any exact divisor.

    :param base_value: value to be converted from a base unit
    :param base_unit: unit of *value*. Should be one of the base units (case sensitive):

            * For space: ``B``, ``kB``, ``MB``;
            * For time: ``ms``, ``s``, ``min``.

    :returns: :class:`str` value representing *base_value* converted from *base_unit* to the greatest
        possible human-friendly unit, or ``None`` if conversion failed.

    :Example:

        >>> convert_real_from_base_unit(5, 'ms')
        '5ms'

        >>> convert_real_from_base_unit(2.5, 'ms')
        '2500us'

        >>> convert_real_from_base_unit(4.0, '256MB')
        '1GB'

        >>> convert_real_from_base_unit(4.0, '256 MB') is None
        True
    
patroni/utils.py