Truns a frozen sample into a TAR file.

def format(collection, **params):
    """Truns a frozen sample into a TAR file."""
    binary = io.BytesIO()
    with tarfile.TarFile(fileobj=binary, mode='w') as tar:
        mode = params.get('mode', 0o640)
        now = calendar.timegm(datetime.datetime.utcnow().timetuple())
        for filename, content in collection:
            content_type, encoding = mimetypes.guess_type(filename)
            content = content_types.get(content_type).format(content, **params)
            content = content_encodings.get(encoding).encode(content)
            member_content = io.BytesIO(content)
            member_info = tarfile.TarInfo(filename)
            member_info.size = len(content)
            member_info.mode = mode
            member_info.mtime = now
            tar.addfile(member_info, member_content)
    binary.seek(0)
    return binary.read()