def compress_file(file, output_file=None):
    """
    Compress a gzip-compressed file out-of-memory.
    Output default is same as ``file`` but with ".gz" ending.
    """
    import shutil
    import gzip
    if output_file is None:
        output_file = file + '.gz'
    with open(file, 'rb') as _in:
        with gzip.open(output_file, 'wb') as _out:
            shutil.copyfileobj(_in, _out)
