def _raise_typeerror(X):
 input_type = (X.format if sp.issparse(X) else type(X))
 err = ('Expected a CSR or CSC sparse matrix, got %s.' % input_type)
 raise TypeError(err)

def _raise_typeerror ( X ) : input_type = ( X . format if sp . issparse ( X ) else type ( X ) ) err = ( 'Expected a CSR or CSC sparse matrix, got %s.' % input_type ) raise TypeError ( err )
raises a typeerror if x is not a csr or csc matrix .