def copy_files(source, dest, buffer_size=1024 * 1024):
    """
    Copy a file from source to dest. source and dest must be file-like objects.
    """
    while True:
        copy_buffer = source.read(buffer_size)
        if not copy_buffer:
            break
        dest.write(copy_buffer)
