code: def sympy_to_scipy_sparse(m, **options):
      """Convert a SymPy Matrix/complex number to a numpy matrix or scalar."""
      if not np or not sparse:
          raise ImportError
      dtype = options.get("dtype", "complex")
      if isinstance(m, MatrixBase):
          return sparse.csr_matrix(np.array(m.tolist(), dtype=dtype))
      elif isinstance(m, Expr):
          if m.is_Number or m.is_NumberSymbol or m == I:
              return complex(m)
      raise TypeError(
          "Expected MatrixBase or complex scalar, got: %r" % m
      )
  
imports: from sympy.core.expr import Expr
  from sympy.core.numbers import I
  from sympy.core.singleton import S
  from sympy.matrices.matrixbase import MatrixBase
  from sympy.matrices import eye, zeros
  from sympy.external import import_module
label_desc: Use image node_id 2 for calling a global function with example usage: sympy_to_scipy_sparse(m) and returns: sparse, complex