def get_param_diff(old_value: Any, new_value: Any,
                   vartype: Optional[str] = None, unit: Optional[str] = None) -> Dict[str, str]:
    """Get a dictionary representing a single PG parameter's value diff.

    :param old_value: current :class:`str` parameter value.
    :param new_value: :class:`str` value of the parameter after a restart.
    :param vartype: the target type to parse old/new_value. See ``vartype`` argument of
        :func:`~patroni.utils.maybe_convert_from_base_unit`.
    :param unit: unit of *old/new_value*. See ``base_unit`` argument of
        :func:`~patroni.utils.maybe_convert_from_base_unit`.

    :returns: a :class:`dict` object that contains two keys: ``old_value`` and ``new_value``
        with their values casted to :class:`str` and converted from base units (if possible).
    """
    str_value: Callable[[Any], str] = lambda x: '' if x is None else str(x)
    return {
        'old_value': (maybe_convert_from_base_unit(str_value(old_value), vartype, unit)
                      if vartype else str_value(old_value)),
        'new_value': (maybe_convert_from_base_unit(str_value(new_value), vartype, unit)
                      if vartype else str_value(new_value))
    }
Get a dictionary representing a single PG parameter's value diff.

    :param old_value: current :class:`str` parameter value.
    :param new_value: :class:`str` value of the parameter after a restart.
    :param vartype: the target type to parse old/new_value. See ``vartype`` argument of
        :func:`~patroni.utils.maybe_convert_from_base_unit`.
    :param unit: unit of *old/new_value*. See ``base_unit`` argument of
        :func:`~patroni.utils.maybe_convert_from_base_unit`.

    :returns: a :class:`dict` object that contains two keys: ``old_value`` and ``new_value``
        with their values casted to :class:`str` and converted from base units (if possible).
    
patroni/postgresql/config.py