from typing import List
import io
import csv
import base64


def to_csv_data_url(data: List[List], header: List[str]) -> str:
    """ Return data url with base64-encoded csv.
    """
    f = io.StringIO()
    writer = csv.writer(f)
    writer.writerow(header)
    writer.writerows(data)
    b64data = base64.b64encode(f.getvalue().encode('utf8')).decode('ascii')
    return f'data:text/csv;base64,{b64data}'