code: def check_py2exe_file(pe):
      
      py2exe_resource = _get_scripts_resource(pe)
  
      if py2exe_resource is None:
          logging.info('This is not a py2exe executable.')
          if pe.__data__.find(b'pyi-windows-manifest-filename'):
              logging.info('This seems a pyinstaller executable (unsupported).')
  
      return bool(py2exe_resource)
docs: Check file is a py2exe executable.