def det_quick(M, method=None):
 if any((i.has(Symbol) for i in M)):
  if ((M.rows < 8) and all((i.has(Symbol) for i in M))):
   return det_perm(M)
  return det_minor(M)
 else:
  return (M.det(method=method) if method else M.det())

def det_quick ( M , method = None ) : if any ( ( i . has ( Symbol ) for i in M ) ) : if ( ( M . rows < 8 ) and all ( ( i . has ( Symbol ) for i in M ) ) ) : return det_perm ( M ) return det_minor ( M ) else : return ( M . det ( method = method ) if method else M . det ( ) )
return det(m) assuming that either there are lots of zeros or the size of the matrix is small .