code: def infer_import(context, tree_name, is_goto=False):
      module_context = context.get_root_context()
      import_node = search_ancestor(
          tree_name, "import_name", "import_from"
      )
      import_path = import_node.get_path_for_name(tree_name)
      from_import_name = None
      evaluator = context.evaluator
      try:
          from_names = import_node.get_from_names()
      except AttributeError:
          # Is an import_name
          pass
      else:
          if len(from_names) + 1 == len(import_path):
              # We have to fetch the from_names part first and then check
              # if from_names exists in the modules.
              from_import_name = import_path[-1]
              import_path = from_names
  
      importer = Importer(
          evaluator,
          tuple(import_path),
          module_context,
          import_node.level,
      )
  
      types = importer.follow()
  
      # if import_node.is_nested() and not self.nested_resolve:
      #    scopes = [NestedImportModule(module, import_node)]
  
      if not types:
          return NO_CONTEXTS
  
      if from_import_name is not None:
          types = unite(
              t.py__getattribute__(
                  from_import_name,
                  name_context=context,
                  is_goto=is_goto,
                  analysis_errors=False,
              )
              for t in types
          )
          if not is_goto:
              types = ContextSet.from_set(types)
  
          if not types:
              path = import_path + [from_import_name]
              importer = Importer(
                  evaluator,
                  tuple(path),
                  module_context,
                  import_node.level,
              )
              types = importer.follow()
              # goto only accepts `Name`
              if is_goto:
                  types = set(s.name for s in types)
      else:
          # goto only accepts `Name`
          if is_goto:
              types = set(s.name for s in types)
  
      debug.dbg("after import: %s", types)
      return types
  
imports: import os
  from parso.python import tree
  from parso.tree import search_ancestor
  from parso import python_bytes_to_unicode
  from jedi._compatibility import FileNotFoundError, ImplicitNSInfo, force_unicode, unicode
  from jedi import debug
  from jedi import settings
  from jedi.parser_utils import get_cached_code_lines
  from jedi.evaluate import sys_path
  from jedi.evaluate import helpers
  from jedi.evaluate import compiled
  from jedi.evaluate import analysis
  from jedi.evaluate.utils import unite
  from jedi.evaluate.cache import evaluator_method_cache
  from jedi.evaluate.filters import AbstractNameDefinition
  from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS
label_desc: Use image node_id 1 for calling a global function with example usage: infer_import(context, tree_name, is_goto) and returns: types, NO_CONTEXTS