code: def rotate(self, matrix, tol=1e-3):
          
          matrix = SquareTensor(matrix)
          if not matrix.is_rotation(tol):
              raise ValueError("Rotation matrix is not valid.")
          sop = SymmOp.from_rotation_and_translation(matrix,
                                                     [0., 0., 0.])
          return self.transform(sop)
docs: Applies a rotation directly, and tests input matrix to ensure a valid
          rotation.
  
          Args:
              matrix (3x3 array-like): rotation matrix to be applied to tensor
              tol (float): tolerance for testing rotation matrix validity