def add(self, start, end=_empty):
        """
        Add another range

        @type start: L{int}
        @param start: Start of range, or only message number

        @type end: Optional L{int}
        @param end: End of range.
        """
        if end is self._empty:
            end = start

        if self._last is not self._empty:
            if start is None:
                start = self.last
            if end is None:
                end = self.last

        start, end = sorted(
            [start, end],
            key=functools.partial(_swap, that=self._infinity, ifIs=None))
        self.ranges.append((start, end))
        self.clean()

        Add another range

        @type start: L{int}
        @param start: Start of range, or only message number

        @type end: Optional L{int}
        @param end: End of range.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/imap4.py