import io
import zipfile


def _zip(file_dict):
    """
    Zips up the provided dict of file-like objects.

    Returns a single file-like object with all the file archived together.
    """
    # Create in-memory file
    buffer = io.BytesIO()

    # Turn it into a zipfile
    with zipfile.ZipFile(buffer, mode="w", compression=zipfile.ZIP_DEFLATED) as zf:
        # Walk thru each piece in the tarfile ...
        for n, f in file_dict.items():
            # ... and add it to the in-memory zipfile
            zf.writestr(n, f.getvalue())
    # Pass back the buffer with the zip in it
    return buffer