def listCapabilities(self):
        """
        Return a list of server capabilities suitable for use in a CAPA
        response.

        @rtype: L{list} of L{bytes}
        @return: A list of server capabilities.
        """
        baseCaps = [
            b"TOP",
            b"USER",
            b"UIDL",
            b"PIPELINE",
            b"CELERITY",
            b"AUSPEX",
            b"POTENCE",
        ]

        if IServerFactory.providedBy(self.factory):
            # Oh my god.  We can't just loop over a list of these because
            # each has spectacularly different return value semantics!
            try:
                v = self.factory.cap_IMPLEMENTATION()
                if v and not isinstance(v, bytes):
                    v = str(v).encode("utf-8")
            except NotImplementedError:
                pass
            except:
                log.err()
            else:
                baseCaps.append(b"IMPLEMENTATION " + v)

            try:
                v = self.factory.cap_EXPIRE()
                if v and not isinstance(v, bytes):
                    v = str(v).encode("utf-8")
            except NotImplementedError:
                pass
            except:
                log.err()
            else:
                if v is None:
                    v = b"NEVER"
                if self.factory.perUserExpiration():
                    if self.mbox:
                        v = str(self.mbox.messageExpiration).encode("utf-8")
                    else:
                        v = v + b" USER"
                baseCaps.append(b"EXPIRE " + v)

            try:
                v = self.factory.cap_LOGIN_DELAY()
                if v and not isinstance(v, bytes):
                    v = str(v).encode("utf-8")
            except NotImplementedError:
                pass
            except:
                log.err()
            else:
                if self.factory.perUserLoginDelay():
                    if self.mbox:
                        v = str(self.mbox.loginDelay).encode("utf-8")
                    else:
                        v = v + b" USER"
                baseCaps.append(b"LOGIN-DELAY " + v)

            try:
                v = self.factory.challengers
            except AttributeError:
                pass
            except:
                log.err()
            else:
                baseCaps.append(b"SASL " + b' '.join(v.keys()))
        return baseCaps

        Return a list of server capabilities suitable for use in a CAPA
        response.

        @rtype: L{list} of L{bytes}
        @return: A list of server capabilities.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/pop3.py