def define_request(
    dataset, query=None, crs="epsg:4326", bounds=None, sortby=None, pagesize=10000
):
    table = validate_name(dataset)
    n = bcdata.get_count(table, query=query)
    chunks = math.ceil(n / pagesize)
    if chunks > 1 and not sortby:
        sortby = get_sortkey(table)
    param_dicts = []
    for i in range(chunks):
        request = {
            "service": "WFS",
            "version": "2.0.0",
            "request": "GetFeature",
            "typeName": table,
            "outputFormat": "json",
            "SRSNAME": crs,
        }
        if sortby:
            request["sortby"] = sortby
        if query:
            request["CQL_FILTER"] = query
        if bounds:
            request["bbox"] = ",".join([str(b) for b in bounds])
        if chunks > 1:
            request["startIndex"] = i * pagesize
            request["count"] = pagesize
        param_dicts.append(request)
    return param_dicts