code: def isIdentity(M, tol=1e-06):
      
      for i in [0, 1, 2, 3]:
          for j in [0, 1, 2, 3]:
              e = M.GetElement(i, j)
              if i == j:
                  if np.abs(e - 1) > tol:
                      return False
              elif np.abs(e) > tol:
                  return False
      return True
docs: Check if vtkMatrix4x4 is Identity.