code: def _compress(operation, data, ctx):
      
      compressed = ctx.compress(data)
      request_id = _randint()
  
      header = _pack_compression_header(
          _COMPRESSION_HEADER_SIZE + len(compressed), # Total message length
          request_id, # Request id
          0, # responseTo
          2012, # operation id
          operation, # original operation id
          len(data), # uncompressed message length
          ctx.compressor_id) # compressor id
      return request_id, header + compressed
docs: Takes message data, compresses it, and adds an OP_COMPRESSED header.