def cache_from_source(path, debug_override=None):
debug = not sys.flags.optimize if debug_override is None else debug_override<EOL>if debug:<EOL><INDENT>suffixes = DEBUG_BYTECODE_SUFFIXES<EOL><DEDENT>else:<EOL><INDENT>suffixes = OPTIMIZED_BYTECODE_SUFFIXES<EOL>pass<EOL><DEDENT>head, tail = os.path.split(path)<EOL>base_filename, sep, _ = tail.partition('<STR_LIT:.>')<EOL>if not hasattr(sys, '<STR_LIT>'):<EOL><INDENT>raise NotImplementedError('<STR_LIT>')<EOL><DEDENT>tag = sys.implementation.cache_tag<EOL>if tag is None:<EOL><INDENT>raise NotImplementedError('<STR_LIT>')<EOL><DEDENT>filename = '<STR_LIT>'.join([base_filename, sep, tag, suffixes[<NUM_LIT:0>]])<EOL>return os.path.join(head, _PYCACHE, filename)<EOL>
Given the path to a .py file, return the path to its .pyc/.pyo file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc/.pyo file calculated as if the .py file were imported.  The extension
    will be .pyc unless sys.flags.optimize is non-zero, then it will be .pyo.

    If debug_override is not None, then it must be a boolean and is used in
    place of sys.flags.optimize.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.