code: def matrix2numpy(m, dtype=object):  # pragma: no cover
      """Converts SymPy's matrix to a NumPy array.
  
      See Also
      ========
  
      list2numpy
      """
      from numpy import empty
  
      a = empty(m.shape, dtype)
      for i in range(m.rows):
          for j in range(m.cols):
              a[i, j] = m[i, j]
      return a
  
imports: import random
  from sympy.core.basic import Basic
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol
  from sympy.core.sympify import sympify
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.utilities.decorator import doctest_depends_on
  from sympy.utilities.exceptions import sympy_deprecation_warning
  from sympy.utilities.iterables import is_sequence
  from .exceptions import ShapeError
  from .decompositions import _cholesky, _LDLdecomposition
  from .matrixbase import MatrixBase
  from .repmatrix import MutableRepMatrix, RepMatrix
  from .solvers import _lower_triangular_solve, _upper_triangular_solve
label_desc: Use image node_id 4 for calling a global function with example usage: matrix2numpy(m, dtype) and returns: a