docstr: Params:
      driver (PersistenceDriver)
      data (Bytes): Uncompressed data
  
  Return: Bytes
docstr_tok: ["Params",":","driver","(","PersistenceDriver",")","data","(","Bytes",")",":","Uncompressed","data","Return",":","Bytes"]
code: def gz_compress(driver, data):
      """
      Params:
          driver (PersistenceDriver)
          data (Bytes): Uncompressed data
  
      Return: Bytes
      """
      try:
          original_size = sys.getsizeof(data)
          data = zlib.compress(data, level=zlib.Z_BEST_COMPRESSION)
          LOGGER.debug(
              "LookupTable (%s): Successfully compressed input data from %d to %d bytes",
              driver.id,
              original_size,
              sys.getsizeof(data),
          )
          return data
      except zlib.error:
          LOGGER.exception(
              "LookupTable (%s): Data compression error.", driver.id
          )
  
imports: import json
  import sys
  import time
  import zlib
  import boto3
  from botocore.exceptions import ClientError, ConnectTimeoutError, ReadTimeoutError
  import streamalert.shared.helpers.boto
  from streamalert.shared.logger import get_logger
  from streamalert.shared.lookup_tables.cache import DriverCache
  from streamalert.shared.lookup_tables.drivers import PersistenceDriver
  from streamalert.shared.lookup_tables.errors import LookupTablesCommitError, LookupTablesInitializationError
label_desc: Use image node_id 2 for calling the Compression obj's underlying member method code with example usage: obj.gz_compress(driver, data) and returns: data