import six
import gzip


def compress_bytes(string):
    """Compress byte string with GZip

    Parameters
    ----------
    string : byte string
        String to be compressed.

    Returns
    -------
    byte string
        Compressed string.
    """
    file_ = six.BytesIO()
    gzip.GzipFile(fileobj=file_, mode='w').write(string)
    return file_.getvalue()