def _get_encoding_opt(synchronizer, extra_opts, default):
    """Helper to figure out encoding setting inside constructors."""
    encoding = default
    # if synchronizer and "encoding" in synchronizer.options:
    #     encoding = synchronizer.options.get("encoding")
    if extra_opts and "encoding" in extra_opts:
        encoding = extra_opts.get("encoding")
    if encoding:
        # Normalize name (e.g. 'UTF8' => 'utf-8')
        encoding = codecs.lookup(encoding).name
    # print("_get_encoding_opt", encoding)
    return encoding or None
Helper to figure out encoding setting inside constructors.