code: def define_request(
      dataset, query=None, crs="epsg:4326", bounds=None, sortby=None, pagesize=10000
  ):
      
      # validate the table name and find out how many features it holds
      table = validate_name(dataset)
      n = bcdata.get_count(table, query=query)
  
      # DataBC WFS getcapabilities says that it supports paging,
      # and the spec says that responses should include 'next URI'
      # (section 7.7.4.4.1)....
      # But I do not see any next uri in the responses. Instead of following
      # the paged urls, for datasets with >10k records, just generate urls
      # based on number of features in the dataset.
      chunks = math.ceil(n / pagesize)
  
      # if making several requests, we need to sort by something
      if chunks > 1 and not sortby:
          sortby = get_sortkey(table)
  
      # build the request parameters for each chunk
      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
docs: Define the getfeature request parameters required to download a dataset
  
      References:
      - http://www.opengeospatial.org/standards/wfs
      - http://docs.geoserver.org/stable/en/user/services/wfs/vendor.html
      - http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html