':param socket sock: A tracked bound listen socket
:returns: The port the socket is bound to.'

def port_for_sock(self, sock):

    for (port, sock_data) in self.sock_data_by_port.items():
        if (sock_data['sock'] == sock):
            return port
