code: def compress(data):
      
  
      if isinstance(data, bytes):
          source = data
      elif isinstance(data, str):
          source = bytes(data, encoding='utf-8')
      else:
          raise RuntimeError("Compression is only supported for strings and bytes")
  
      return base64.b64encode(gzip.compress(source))
docs: Compresses a string (or bytes) using Gzip and returns its Base64 representation
  
      :param data: string or bytes
      :return: Base64 (bytes) representation of compressed data