def _win_path_to_bytes(path):
for encoding in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>return path.encode(encoding)<EOL><DEDENT>except (UnicodeEncodeError, LookupError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return path<EOL>
Encode Windows paths to bytes. Only used on Python 2.

    Motivation is to be consistent with other operating systems where paths
    are also returned as bytes. This avoids problems mixing bytes and Unicode
    elsewhere in the codebase. For more details and discussion see
    <https://github.com/pypa/pip/issues/3463>.

    If encoding using ASCII and MBCS fails, return the original Unicode path.