code: def _sort_results(self, results):
          
  
          parents = []
          groups = []
          for result in results:
              if not self._in_list(parents, result.parent):
                  parents.append(result.parent)
                  groups.append([])
                  groups[len(groups) - 1].append(result)
              else:
                  groups[parents.index(result.parent)].append(result)
          array = []
          for group in groups:
              array += sorted(
                  group,
                  key=lambda element: element.parent.contents.index(element)
              )
          return array
docs: Order the results.
  
          :param results: The disordened results.
          :type results: array.bs4.element.Tag
          :return: The ordened results.
          :rtype: array.bs4.element.Tag