Writing filtered data to file after lasso and box selection

I have seen this post Using box_select to Return a Filtered Dataframe - Panel - HoloViz Discourse, but it doesn’t work for lasso selection as I expected. What I need is to to have the filtered data exported to a csv file. Here is a sample code:

import spatialpandas
import shapely
import holoviews as hv
import param
import panel as pn
import numpy as np
import pandas as pd
import io

hv.extension("bokeh")

def main():

    np.random.seed(42)
    n = 1000
    data = {
        'x': np.random.uniform(0, 10, n),
        'y': np.random.uniform(0, 10, n),
        'attribute1': np.random.choice(['A', 'B', 'C', 'D'], n),
        'attribute2': np.random.uniform(0, 100, n),
        'attribute3': np.random.uniform(0, 100, n),
    }

    df = pd.DataFrame(data)

    # Create a Holoviews dataset
    dataset = hv.Dataset(df)

    # Create a scatter plot for x, y colored by attribute1
    points = hv.Points(dataset, kdims=['x', 'y'], vdims=['attribute1']).opts(color='attribute1', cmap='Category10', size=5)

    # Create a scatter plot for attribute2 vs attribute3 colored by attribute1
    scatter = hv.Scatter(dataset, kdims=['attribute2', 'attribute3'], vdims=['attribute1']).opts(color='attribute1', cmap='Category10', size=5)

    def download_callback():
        sio = io.StringIO()            
        df.to_csv(sio, index=True)
        sio.seek(0)
        return sio


    download =pn.widgets.FileDownload(
            callback=download_callback,
            filename="file.csv",
            height=50,
            width=200,
        )

    component = pn.Row(hv.selection.link_selections(points + scatter), download)    

    template = pn.template.FastListTemplate(
        main=[component],
    )
    template.servable()

main()

I appreciate any help.