docs: def __doc_cmp(self, other):
          """
          Comparison function. Can be used to sort docs alphabetically.
          """
          if other is None:
              return -1
          if self.is_new and other.is_new:
              return 0
          if self.__docid < other.__docid:
              return -1
          elif self.__docid == other.__docid:
              return 0
          else:
              return 1