def _transform_parameter_value(validators: MutableMapping[str, Tuple[_Transformable, ...]],
                               version: int, name: str, value: Any,
                               available_gucs: CaseInsensitiveSet) -> Optional[Any]:
    """Validate *value* of GUC *name* for Postgres *version* using defined *validators* and *available_gucs*.

    :param validators: a dictionary of all GUCs across all Postgres versions. Each key is the name of a Postgres GUC,
        and the corresponding value is a variable length tuple of :class:`_Transformable`. Each item is a validation
        rule for the GUC for a given range of Postgres versions. Should either contain recovery GUCs or general GUCs,
        not both.
    :param version: Postgres version to validate the GUC against.
    :param name: name of the Postgres GUC.
    :param value: value of the Postgres GUC.
    :param available_gucs: a set of all GUCs available in Postgres *version*. Each item is the name of a Postgres
        GUC. Used to avoid ignoring GUC *name* if it does not have a validator in *validators*, but is a valid GUC
        in Postgres *version*.

    :returns: the return value may be one among:

        * *value* transformed to the expected format for GUC *name* in Postgres *version*, if *name* has a validator
          in *validators* for the corresponding Postgres *version*; or
        * ``None`` if *name* does not have a validator in *validators* and is not present in *available_gucs*.
    """
    for validator in validators.get(name, ()) or ():
        if version >= validator.version_from and\
                (validator.version_till is None or version < validator.version_till):
            return validator.transform(name, value)
    # Ideally we should have a validator in *validators*. However, if none is available, we will not discard a
    # setting that exists in Postgres *version*, but rather allow the value with no validation.
    if name in available_gucs:
        return value
    logger.warning('Removing unexpected parameter=%s value=%s from the config', name, value)
Validate *value* of GUC *name* for Postgres *version* using defined *validators* and *available_gucs*.

    :param validators: a dictionary of all GUCs across all Postgres versions. Each key is the name of a Postgres GUC,
        and the corresponding value is a variable length tuple of :class:`_Transformable`. Each item is a validation
        rule for the GUC for a given range of Postgres versions. Should either contain recovery GUCs or general GUCs,
        not both.
    :param version: Postgres version to validate the GUC against.
    :param name: name of the Postgres GUC.
    :param value: value of the Postgres GUC.
    :param available_gucs: a set of all GUCs available in Postgres *version*. Each item is the name of a Postgres
        GUC. Used to avoid ignoring GUC *name* if it does not have a validator in *validators*, but is a valid GUC
        in Postgres *version*.

    :returns: the return value may be one among:

        * *value* transformed to the expected format for GUC *name* in Postgres *version*, if *name* has a validator
          in *validators* for the corresponding Postgres *version*; or
        * ``None`` if *name* does not have a validator in *validators* and is not present in *available_gucs*.
    
patroni/postgresql/validator.py