'Send the data frame.
frame: frame data created  by ABNF.create_frame
>>> ws = create_connection("ws://echo.websocket.org/")
>>> frame = ABNF.create_frame("Hello", ABNF.OPCODE_TEXT)
>>> ws.send_frame(frame)
>>> cont_frame = ABNF.create_frame("My name is ", ABNF.OPCODE_CONT, 0)
>>> ws.send_frame(frame)
>>> cont_frame = ABNF.create_frame("Foo Bar", ABNF.OPCODE_CONT, 1)
>>> ws.send_frame(frame)'

def send_frame(self, frame):

    if self.get_mask_key:
        frame.get_mask_key = self.get_mask_key
    data = frame.format()
    length = len(data)
    trace(('send:    ' + repr(data)))
    with self.lock:
        while data:
            l = self._send(data)
            data = data[l:]
    return length
