code: def inertia_tensor(geom, masses):
      import numpy as np
      geom = ctr_geom(geom, masses)
      if geom.shape[0] == 3*masses.shape[0]:
          masses = masses.repeat(3)
      tensor = np.zeros((3,3))
      for i in range(3):
          for j in range(i,3):
              if i == j:
                  ind = np.concatenate([np.array(list(map(lambda v: v % 3,
                                          range(i+1, i+3)))) + o for o in
                                          range(0,geom.shape[0],3)])
                  tensor[i,i] = np.multiply(np.square(geom[ind]),
                                                          masses[ind]).sum()
              else:
                  ind_i = np.array(range(i,geom.shape[0]+i,3))
                  ind_j = np.array(range(j,geom.shape[0]+j,3))
                  tensor[i,j] = np.multiply(
                          np.sqrt(np.multiply(masses[ind_i], masses[ind_j])) ,
                          np.multiply(geom[ind_i], geom[ind_j]) ).sum() * -1
                  tensor[j,i] = tensor[i,j]
      return tensor