def format_addresses(ws):
    me = ws.local_address
    peer = ws.peer_address
    if isinstance(me, tuple) and isinstance(peer, tuple):
        me_ip, me_port = ws.local_address
        peer_ip, peer_port = ws.peer_address
        return "[Local => %s:%d | Remote => %s:%d]" % (me_ip, me_port, peer_ip, peer_port)

    return "[Bound to '%s']" % me
dataset/ETHPy150Open Lawouach/WebSocket-for-Python/ws4py/__init__.py/format_addresses/original