code: def transform_tensor(self, tensor):
          
          dim = tensor.shape
          rank = len(dim)
          assert all([i == 3 for i in dim])
          # Build einstein sum string
          lc = string.ascii_lowercase
          indices = lc[:rank], lc[rank:2 * rank]
          einsum_string = ','.join([a + i for a, i in zip(*indices)])
          einsum_string += ',{}->{}'.format(*indices[::-1])
          einsum_args = [self.rotation_matrix] * rank + [tensor]
  
          return np.einsum(einsum_string, *einsum_args)
docs: Applies rotation portion to a tensor. Note that tensor has to be in
          full form, not the Voigt form.
  
          Args:
              tensor (numpy array): a rank n tensor
  
          Returns:
              Transformed tensor.