code: def _get_mask(self, struct1, struct2, fu, s1_supercell):
          
          mask = np.zeros((len(struct2), len(struct1), fu), dtype=np.bool)
  
          inner = []
          for sp2, i in itertools.groupby(enumerate(struct2.species_and_occu),
                                          key=lambda x: x[1]):
              i = list(i)
              inner.append((sp2, slice(i[0][0], i[-1][0]+1)))
  
          for sp1, j in itertools.groupby(enumerate(struct1.species_and_occu),
                                          key=lambda x: x[1]):
              j = list(j)
              j = slice(j[0][0], j[-1][0]+1)
              for sp2, i in inner:
                  mask[i, j, :] = not self._comparator.are_equal(sp1, sp2)
  
          if s1_supercell:
              mask = mask.reshape((len(struct2), -1))
          else:
              # supercell is of struct2, roll fu axis back to preserve
              # correct ordering
              mask = np.rollaxis(mask, 2, 1)
              mask = mask.reshape((-1, len(struct1)))
  
          # find the best translation indices
          i = np.argmax(np.sum(mask, axis=-1))
          inds = np.where(np.invert(mask[i]))[0]
          if s1_supercell:
              # remove the symmetrically equivalent s1 indices
              inds = inds[::fu]
          return np.array(mask, dtype=np.int_), inds, i
docs: Returns mask for matching struct2 to struct1. If struct1 has sites
          a b c, and fu = 2, assumes supercells of struct2 will be ordered
          aabbcc (rather than abcabc)
  
          Returns:
          mask, struct1 translation indices, struct2 translation index