code: def get_imports(project, pydefined):
      
      pymodule = pydefined.get_module()
      module = module_imports.ModuleImports(project, pymodule)
      if pymodule == pydefined:
          return [stmt.import_info for stmt in module.imports]
      return module.get_used_imports(pydefined)
docs: A shortcut for getting the `ImportInfo`\s used in a scope