code: def _get_variable_name_from_code_str(code):
      tree = ast.parse(code)
  
      # Example:
      #
      # tree = Module(
      #   body=[
      #     Expr(
      #       value=Call(
      #         args=[
      #           Name(id='the variable name')
      #         ],
      #         keywords=[
      #           ???
      #         ],
      #       )
      #     )
      #   ]
      # )
  
      # Check if this is an magic call (i.e. it's not st.help or st.write).
      # If that's the case, just clean it up and return it.
      if not _is_stcommand(
          tree, command_name="help"
      ) and not _is_stcommand(tree, command_name="write"):
          # A common pattern is to add "," at the end of a magic command to make it print.
          # This removes that final ",", so it looks nicer.
          if code.endswith(","):
              code = code[:-1]
  
          return code
  
      arg_node = _get_stcommand_arg(tree)
  
      # If st.help() is called without an argument, return no variable name.
      if not arg_node:
          return None
  
      # If walrus, get name.
      # E.g. st.help(foo := 123) should give you "foo".
      elif type(arg_node) is ast.NamedExpr:
          # This next "if" will always be true, but need to add this for the type-checking test to
          # pass.
          if type(arg_node.target) is ast.Name:
              return arg_node.target.id
  
      # If constant, there's no variable name.
      # E.g. st.help("foo") or st.help(123) should give you None.
      elif type(arg_node) in (
          ast.Constant,
          # Python 3.7 support:
          ast.Num,
          ast.Str,
          ast.Bytes,
          ast.NameConstant,
          ast.Ellipsis,
      ):
          return None
  
      # Otherwise, return whatever is inside st.help(<-- here -->)
  
      # But, if multiline, only return the first line.
      code_lines = code.split("\n")
      is_multiline = len(code_lines) > 1
  
      start_offset = arg_node.col_offset
  
      if is_multiline:
          first_lineno = arg_node.lineno - 1  # Lines are 1-indexed!
          first_line = code_lines[first_lineno]
          end_offset = None
  
      else:
          first_line = code_lines[0]
          end_offset = getattr(arg_node, "end_col_offset", -1)
  
      return first_line[start_offset:end_offset]
  
imports: import ast
  import contextlib
  import inspect
  import re
  import types
  from typing import TYPE_CHECKING, Any, cast
  from typing_extensions import Final
  import streamlit
  from streamlit.logger import get_logger
  from streamlit.proto.DocString_pb2 import DocString
  from streamlit.proto.DocString_pb2 import Member
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner.script_runner import __file__
  from streamlit.runtime.secrets import Secrets
  from streamlit.string_util import is_mem_address_str
label_desc: Use image node_id 7 for calling a global function with example usage: _get_variable_name_from_code_str(code) and returns: first_line, code, None, arg_node, None