def add_zip_flat(zip, filename):
    dir, base_filename = os.path.split(filename)
os.chdir(dir)
zip.write(base_filename)
zip = zipfile.ZipFile(buffer, 'w')
add_zip_flat(zip, first_path)
add_zip_flat(zip, second_path)
zip.close()
python/zip: How to eliminate absolute path in zip archive if absolute paths for files are provided?