def METHOD_NAME():
    # locale._parse_localename makes locale.getpreferredencoding
    # return None when LC_ALL is C, instead of e.g. 'US-ASCII' or
    # 'ANSI_X3.4-1968' when it uses nl_langinfo.
    encoding = None
    try:
        encoding = locale.METHOD_NAME()
    except ValueError:
        # On english OSX, LC_ALL is UTF-8 (not en-US.UTF-8), and
        # that throws off locale._parse_localename, which ends up
        # being used on e.g. homebrew python.
        if os.environ.get("LC_ALL", "").upper() == "UTF-8":
            encoding = "utf-8"
    return encoding