code: def _force_mutable(x):
      """Return a matrix as a Matrix, otherwise return x."""
      if getattr(x, "is_Matrix", False):
          return x.as_mutable()
      elif isinstance(x, Basic):
          return x
      elif hasattr(x, "__array__"):
          a = x.__array__()
          if len(a.shape) == 0:
              return sympify(a)
          return Matrix(x)
      return x
  
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 2 for calling a global function with example usage: _force_mutable(x) and returns: x, x, x, Matrix, sympify