import json
import gzip


def compress(content):
    """
    Return a byte string of `content` gzipped-compressed.
    `content` is eiher a string or a JSON-serializable data structure.
    """
    if isinstance(content, str):
        content = content.encode('utf-8')
    else:
        content = json.dumps(content , separators=(',', ':')).encode('utf-8')
    return gzip.compress(content, compresslevel=9)