code: def compress(obj, level=6, return_type="bytes"):
      
      if isinstance(obj, binary_type):
          b = _compress_bytes(obj, level)
      elif isinstance(obj, string_types):
          b = _compress_str(obj, level)
      else:
          b = _compress_obj(obj, level)
  
      if return_type == "bytes":
          return b
      elif return_type == "str":
          return base64.b64encode(b).decode("utf-8")
      else:
          raise ValueError("'return_type' has to be one of 'bytes', 'str'!")
docs: Compress anything to bytes or string.
  
      :param obj: could be any object, usually it could be binary, string, or
          regular python objec.t
      :param level:
      :param return_type: if bytes, then return bytes; if str, then return
          base64.b64encode bytes in utf-8 string.