def _asarray_square(A):
 A = np.asarray(A)
 if ((len(A.shape) != 2) or (A.shape[0] != A.shape[1])):
  raise ValueError('expected square array_like input')
 return A

def _asarray_square ( A ) : A = np . asarray ( A ) if ( ( len ( A . shape ) != 2 ) or ( A . shape [ 0 ] != A . shape [ 1 ] ) ) : raise ValueError ( 'expected square array_like input' ) return A
wraps asarray with the extra requirement that the input be a square matrix .