code: def find_imports_and_track_names(filename, warn_about_duplicates=False,
                                   verbose=False):
      
      with open(filename) as f:
          root = ast.parse(f.read(), filename)
      visitor = ImportFinderAndNameTracker(filename)
      visitor.warn_about_duplicates = warn_about_duplicates
      visitor.verbose = verbose
      visitor.visit(root)
      visitor.leaveAllScopes()
      return visitor.imports, visitor.unused_names
docs: Find all imported names in a given file.
  
      Returns ``(imports, unused)``.  Both are lists of ImportInfo objects.