def public(self):
        """
        Returns a version of this key containing only the public key data.
        If this is a public key, this may or may not be the same object
        as self.

        @rtype: L{Key}
        @return: A public key.
        """
        if self.isPublic():
            return self
        else:
            return Key(self._keyObject.public_key())

        Returns a version of this key containing only the public key data.
        If this is a public key, this may or may not be the same object
        as self.

        @rtype: L{Key}
        @return: A public key.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/keys.py