code: def get_stack_at_position(grammar, code_lines, module_node, pos):
      """
      Returns the possible node names (e.g. import_from, xor_test or yield_stmt).
      """
  
      class EndMarkerReached(Exception):
          pass
  
      def tokenize_without_endmarker(code):
          # TODO This is for now not an official parso API that exists purely
          #   for Jedi.
          tokens = grammar._tokenize(code)
          for token in tokens:
              if token.string == safeword:
                  raise EndMarkerReached()
              elif token.prefix.endswith(safeword):
                  # This happens with comments.
                  raise EndMarkerReached()
              elif token.string.endswith(safeword):
                  yield token  # Probably an f-string literal that was not finished.
                  raise EndMarkerReached()
              else:
                  yield token
  
      # The code might be indedented, just remove it.
      code = dedent(_get_code_for_stack(code_lines, module_node, pos))
      # We use a word to tell Jedi when we have reached the start of the
      # completion.
      # Use Z as a prefix because it's not part of a number suffix.
      safeword = "ZZZ_USER_WANTS_TO_COMPLETE_HERE_WITH_JEDI"
      code = code + " " + safeword
  
      p = Parser(grammar._pgen_grammar, error_recovery=True)
      try:
          p.parse(tokens=tokenize_without_endmarker(code))
      except EndMarkerReached:
          return p.stack
      raise SystemError(
          "This really shouldn't happen. There's a bug in Jedi:\n%s"
          % list(tokenize_without_endmarker(code))
      )
  
imports: import re
  from collections import namedtuple
  from textwrap import dedent
  from parso.python.parser import Parser
  from parso.python import tree
  from jedi._compatibility import u
  from jedi.evaluate.syntax_tree import eval_atom
  from jedi.evaluate.helpers import evaluate_call_of_leaf
  from jedi.evaluate.compiled import get_string_context_set
  from jedi.cache import call_signature_time_cache
label_desc: Use image node_id 5 for calling a global function with example usage: get_stack_at_position(grammar, code_lines, module_node, pos) and returns: p