def canonical_peer( self, peer ):
        """
        Get the canonical peer name
        """
        their_host, their_port = url_to_host_port( peer )

        if their_host in ['127.0.0.1', '::1']:
            their_host = 'localhost'

        return "%s:%s" % (their_host, their_port)
Get the canonical peer name