code: def group_structures(self, s_list, anonymous=False):
          
          if self._subset:
              raise ValueError("allow_subset cannot be used with"
                               " group_structures")
  
          original_s_list = list(s_list)
          s_list = self._process_species(s_list)
  
          # Use structure hash to pre-group structures
          if anonymous:
              c_hash = lambda c: c.anonymized_formula
          else:
              c_hash = self._comparator.get_hash
          s_hash = lambda s: c_hash(s[1].composition)
          sorted_s_list = sorted(enumerate(s_list), key=s_hash)
          all_groups = []
  
          # For each pre-grouped list of structures, perform actual matching.
          for k, g in itertools.groupby(sorted_s_list, key=s_hash):
              unmatched = list(g)
              while len(unmatched) > 0:
                  i, refs = unmatched.pop(0)
                  matches = [i]
                  if anonymous:
                      inds = filter(lambda i: self.fit_anonymous(refs,
                              unmatched[i][1]), list(range(len(unmatched))))
                  else:
                      inds = filter(lambda i: self.fit(refs, unmatched[i][1]),
                                    list(range(len(unmatched))))
                  inds = list(inds)
                  matches.extend([unmatched[i][0] for i in inds])
                  unmatched = [unmatched[i] for i in range(len(unmatched))
                               if i not in inds]
                  all_groups.append([original_s_list[i] for i in matches])
  
          return all_groups
docs: Given a list of structures, use fit to group
          them by structural equality.
  
          Args:
              s_list ([Structure]): List of structures to be grouped
              anonymous (bool): Wheher to use anonymous mode.
  
          Returns:
              A list of lists of matched structures
              Assumption: if s1 == s2 but s1 != s3, than s2 and s3 will be put
              in different groups without comparison.