def METHOD_NAME(
        dirpath: Optional[Path],
        db_handler: 'DBHandler',
) -> Path:
    """
    Creates a zip file with a json file containing the assets added by the user.
    May raise:
    - PermissionError if the temp file can't be created
    """
    if dirpath is None:
        dirpath = Path(tempfile.TemporaryDirectory().name)
        dirpath.mkdir(parents=True, exist_ok=True)
    globaldb = GlobalDBHandler()
    with db_handler.user_write() as write_cursor, globaldb.conn.read_ctx() as gdb_cursor:
        assets = globaldb.get_user_added_assets(
            cursor=gdb_cursor,
            user_db_write_cursor=write_cursor,
            user_db=db_handler,
        )
    serialized = []
    for asset_identifier in assets:
        try:
            asset = Asset(asset_identifier).resolve()
            serialized.append(asset.to_dict())
        except UnknownAsset as e:
            log.error(e)
    with globaldb.conn.read_ctx() as gdb_cursor:
        query = gdb_cursor.execute('SELECT value from settings WHERE name="version";')
        version = query.fetchone()[0]
        data = {
            'version': version,
            'assets': serialized,
        }
    zip_path = dirpath / 'assets.zip'
    with ZipFile(file=zip_path, mode='w', compression=ZIP_DEFLATED) as assets_zip:
        assets_zip.writestr(
            zinfo_or_arcname='assets.json',
            data=json.dumps(data),
        )
    return zip_path