def _conninfo_parse(value: str) -> Optional[Dict[str, str]]:
    """
    Very simple equivalent of `psycopg2.extensions.parse_dsn` introduced in 2.7.0.
    Exists just for compatibility with 2.5.4+.

    >>> r = _conninfo_parse('postgresql://foo/postgres')
    >>> r == {'dbname': 'postgres', 'host': 'foo'}
    True
    >>> r = _conninfo_parse(" host = 'host' dbname = db\\\\ name requiressl=1 ")
    >>> r == {'dbname': 'db name', 'host': 'host', 'sslmode': 'require'}
    True
    >>> _conninfo_parse('requiressl = 0\\\\') == {'sslmode': 'prefer'}
    True
    """

    if value.startswith('postgres://') or value.startswith('postgresql://'):
        ret = _conninfo_uri_parse(value)
    else:
        ret = _conninfo_dsn_parse(value)

    if ret and 'sslmode' not in ret:  # allow sslmode to take precedence over requiressl
        requiressl = ret.pop('requiressl', None)
        if requiressl == '1':
            ret['sslmode'] = 'require'
        elif requiressl is not None:
            ret['sslmode'] = 'prefer'
    return ret

    Very simple equivalent of `psycopg2.extensions.parse_dsn` introduced in 2.7.0.
    Exists just for compatibility with 2.5.4+.

    >>> r = _conninfo_parse('postgresql://foo/postgres')
    >>> r == {'dbname': 'postgres', 'host': 'foo'}
    True
    >>> r = _conninfo_parse(" host = 'host' dbname = db\\ name requiressl=1 ")
    >>> r == {'dbname': 'db name', 'host': 'host', 'sslmode': 'require'}
    True
    >>> _conninfo_parse('requiressl = 0\\') == {'sslmode': 'prefer'}
    True
    
patroni/postgresql/config.py