code: def construct_chunk(cls, chunk_type, payload, encoding='utf-8'):
      
      if isinstance(payload, str):
        payload = payload.encode(encoding)
      elif not isinstance(payload, bytes):
        raise TypeError('cannot encode type: {}'.format(type(payload)))
  
      header = struct.pack(cls.HEADER_FMT, len(payload), chunk_type)
      return header + payload
docs: Construct and return a single chunk.