'Submit a request object with a timeout value and optional
xid'

def _submit(self, request, timeout, xid=None):

    b = bytearray()
    if xid:
        b.extend(int_struct.pack(xid))
    if request.type:
        b.extend(int_struct.pack(request.type))
    b += request.serialize()
    self.logger.log((BLATHER if isinstance(request, Ping) else logging.DEBUG), 'Sending    request(xid=%s):    %s', xid, request)
    self._write((int_struct.pack(len(b)) + b), timeout)
