'Initialize a buffer with \'data\'.'

def __init__(self, data='', on_write=None, transport_func=None):

    self.buffer = bytes(data)
    self.on_write_f = on_write
    self.waiting_lock = threading.Lock()
    self.data_lock = threading.RLock()
    self.waiting = threading.Event()
    self.transport = transport_func
    self.cookie = None
