@classmethod
def from_getpeername(cls, sock):
    """Creates a :class:`PtrLookup` object based on the IP address of the
        socket's remote address, using :py:meth:`~socket.socket.getpeername`.

        :param sock: The :py:class:`~socket.socket` object to use.
        :returns: A tuple containing the new :class:`PtrLookup` object and the
                  port number from :py:meth:`~socket.socket.getpeername`.

        """
    ip, port = sock.getpeername()
    return cls(ip), port
