docs: def aggregate_routes(
      feed: "Feed", by: str = "route_short_name", route_id_prefix: str = "route_"
  ) -> "Feed":
      """
      Aggregate routes by route short name, say, and assign new route IDs.
  
      Parameters
      ----------
      feed : "Feed"
      by : string
          A column of ``feed.routes``
      route_id_prefix : string
          Prefix to use when creating new route IDs
  
      Returns
      -------
      "Feed"
          The result is built from the given "Feed" as follows.
          Group ``feed.routes`` by the ``by`` column, and for each group
  
          1. Choose the first route in the group
          2. Assign a new route ID based on the given ``route_id_prefix``
             string and a running count, e.g. ``'route_013'``
          3. Assign all the trips associated with routes in the group to
             that first route
          4. Update the route IDs in the other "Feed" tables
  
      """
      if by not in feed.routes.columns:
          raise ValueError(f"Column {by} not in feed.routes")
  
      feed = feed.copy()
  
      # Create new route IDs
      routes = feed.routes
      n = routes.groupby(by).ngroups
      k = int(math.log10(n)) + 1  # Number of digits for padding IDs
      nrid_by_orid = dict()
      i = 1
      for col, group in routes.groupby(by):
          nrid = f"route_{i:0{k}d}"
          d = {orid: nrid for orid in group["route_id"].values}
          nrid_by_orid.update(d)
          i += 1
  
      routes["route_id"] = routes["route_id"].map(lambda x: nrid_by_orid[x])
      routes = routes.groupby(by).first().reset_index()
      feed.routes = routes
  
      # Update route IDs of trips
      trips = feed.trips
      trips["route_id"] = trips["route_id"].map(lambda x: nrid_by_orid[x])
      feed.trips = trips
  
      # Update route IDs of transfers
      if feed.transfers is not None:
          transfers = feed.transfers
          transfers["route_id"] = transfers["route_id"].map(
              lambda x: nrid_by_orid[x]
          )
          feed.transfers = transfers
  
      return feed