code: def dispatch_method(self, basename, arg, **options):
      """Dispatch a method to the proper handlers."""
      method_name = "%s_%s" % (basename, arg.__class__.__name__)
      if hasattr(self, method_name):
          f = getattr(self, method_name)
          # This can raise and we will allow it to propagate.
          result = f(arg, **options)
          if result is not None:
              return result
      raise NotImplementedError(
          "%s.%s cannot handle: %r"
          % (self.__class__.__name__, basename, arg)
      )
  
imports: from sympy.core.expr import Expr
  from sympy.core.symbol import Symbol
  from sympy.core.sympify import sympify
  from sympy.matrices.dense import Matrix
  from sympy.printing.pretty.stringpict import prettyForm
  from sympy.core.containers import Tuple
  from sympy.utilities.iterables import is_sequence
  from sympy.physics.quantum.dagger import Dagger
  from sympy.physics.quantum.matrixutils import numpy_ndarray, scipy_sparse_matrix, to_sympy, to_numpy, to_scipy_sparse
label_desc: Use image node_id 5 for calling a global function with example usage: dispatch_method(basename, arg) and returns: result