def extract_code_objects(pe):
    """Extract Python code objects from a py2exe executable."""
    script_res = _get_scripts_resource(pe)
    dump = _resource_dump(pe, script_res)
    return _get_co_from_dump(dump)
Extract Python code objects from a py2exe executable.