def _force_mutable(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

def _force_mutable ( 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
return a matrix as a matrix .