<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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