code: def load_formatter_from_file(
      filename, formattername="CustomFormatter", **options
  ):
      """Load a formatter from a file.
  
      This method expects a file located relative to the current working
      directory, which contains a class named CustomFormatter. By default,
      it expects the Formatter to be named CustomFormatter; you can specify
      your own class name as the second argument to this function.
  
      Users should be very careful with the input, because this method
      is equivalent to running eval on the input file.
  
      Raises ClassNotFound if there are any problems importing the Formatter.
  
      .. versionadded:: 2.2
      """
      try:
          # This empty dict will contain the namespace for the exec'd file
          custom_namespace = {}
          exec(open(filename, "rb").read(), custom_namespace)
          # Retrieve the class `formattername` from that namespace
          if formattername not in custom_namespace:
              raise ClassNotFound(
                  "no valid %s class found in %s"
                  % (formattername, filename)
              )
          formatter_class = custom_namespace[formattername]
          # And finally instantiate it with the options
          return formatter_class(**options)
      except IOError as err:
          raise ClassNotFound("cannot read %s" % filename)
      except ClassNotFound as err:
          raise
      except Exception as err:
          raise ClassNotFound(
              "error when loading custom formatter: %s" % err
          )
  
file_path: wandb/wandb/vendor/pygments/formatters/__init__.py
imports: import re
  import sys
  import types
  import fnmatch
  from os.path import basename
  from pygments.formatters._mapping import FORMATTERS
  from pygments.plugin import find_plugin_formatters
  from pygments.util import ClassNotFound, itervalues
label_desc: Use image node_id 6 for calling a global function with example usage: load_formatter_from_file(filename, formattername) and returns: formatter_class