'Send data to the switch.
Data should probably either be raw bytes in OpenFlow wire format, or
an OpenFlow controller-to-switch message object from libopenflow.'

def send(self, data):

    if self.disconnected:
        return
    if (type(data) is not bytes):
        assert isinstance(data, of.ofp_header)
        data = data.pack()
    if deferredSender.sending:
        log.debug('deferred    sender    is    sending!')
        deferredSender.send(self, data)
        return
    try:
        l = self.sock.send(data)
        if (l != len(data)):
            self.msg("Didn't    send    complete    buffer.")
            data = data[l:]
            deferredSender.send(self, data)
    except socket.error as (errno, strerror):
        if (errno == EAGAIN):
            self.msg(('Out    of    send    buffer    space.        ' + 'Consider    increasing    SO_SNDBUF.'))
            deferredSender.send(self, data)
        else:
            self.msg(('Socket    error:    ' + strerror))
            self.disconnect(defer_event=True)
