code: def _get_variable(name):
      """Get a variable from the notebook namespace."""
      ip = IPython.get_ipython()
      if ip is None:
          raise ValueError(
              "Magic command must be run within an IPython "
              "environment, in which get_ipython() is defined."
          )
      if name not in ip.user_ns:
          raise NameError(
              "argument '{}' does not match the name of any defined variable".format(
                  name
              )
          )
      return ip.user_ns[name]
  
file_path: altair/altair/_magics.py
imports: import json
  import warnings
  import IPython
  from IPython.core import magic_arguments
  import pandas
  from toolz import curried
  from altair.vegalite import v5
label_desc: Use image node_id 2 for calling a global function with example usage: _get_variable(name) and returns: ip