code: def _package_exists(path):
      # type: (str) -> bool
      
      while path:
          if os.path.exists(path):
              return True
          else:
              path = os.path.dirname(path)
  
      return False
docs: Checks if the given Python path matches a valid file or a valid container
      file
  
      :param path: A Python path
      :return: True if the module or its container exists