def SendChunk(header, data, to_stream):
  send = getattr(to_stream, 'send', None)
  if send is None:
    send = getattr(to_stream, 'write')

  if not data:
    # Send dummy data -- anything with length > 0
    header.is_empty_ = True
    data = '-'
  header.len_ = len(data)
  send(header.Format())
  send(data)
  send('\r\n')
Sends a header and chunked data to the given stream.
dataset/ETHPy150Open google/lab_device_proxy/lab_device_proxy_client.py/SendChunk