def send(self, event: Event) -> bytes:
    'Send an event to the remote.\n\n        This will return the bytes to send based on the event or raise\n        a LocalProtocolError if the event is not valid given the\n        state.\n\n        :returns: Data to send to the WebSocket peer.\n        :rtype: bytes\n        '
    data = b''
    if isinstance(event, Request):
        data += self._initiate_connection(event)
    elif isinstance(event, AcceptConnection):
        data += self._accept(event)
    elif isinstance(event, RejectConnection):
        data += self._reject(event)
    elif isinstance(event, RejectData):
        data += self._send_reject_data(event)
    else:
        raise LocalProtocolError('Event {} cannot be sent during the handshake'.format(event))
    return data
Send an event to the remote.

This will return the bytes to send based on the event or raise
a LocalProtocolError if the event is not valid given the
state.

:returns: Data to send to the WebSocket peer.
:rtype: bytes
def send(self, event: Event) -> bytes:
    'Send an event to the remote.\n\n        This will return the bytes to send based on the event or raise\n        a LocalProtocolError if the event is not valid given the\n        state.\n\n        :returns: Data to send to the WebSocket peer.\n        :rtype: bytes\n        '
    data = b
    if isinstance(event, Request):
        data += self._initiate_connection(event)
    elif isinstance(event, AcceptConnection):
        data += self._accept(event)
    elif isinstance(event, RejectConnection):
        data += self._reject(event)
    elif isinstance(event, RejectData):
        data += self._send_reject_data(event)
    else:
        raise LocalProtocolError('Event {} cannot be sent during the handshake'.format(event))
    return data