def METHOD_NAME(conninfo: str) -> str:
    """
    Return the Python encoding name passed in a conninfo string. Default to utf8.
    Because the input is likely to come from the user and not normalised by the
    server, be somewhat lenient (non-case-sensitive lookup, ignore noise chars).
    """
    from .conninfo import conninfo_to_dict
    params = conninfo_to_dict(conninfo)
    pgenc = params.get("client_encoding")
    if pgenc:
        try:
            return pg2pyenc(pgenc.encode())
        except NotSupportedError:
            pass
    return "utf-8"