code: def _pli_features_rebuild_offsets(pli, features):
      """Takes a modified pairwise_linestring_intersection (_pli) result
      (specifically the first two elements of its result tuple: `(offsets,
      GeoSeries)` and returns a new `offsets` buffer that corresponds with the
      items in the GeoSeries. The GeoSeries in this call is modified from the
      original pairwise_linestring_intersection result because it must be a
      homogeneous GeoSeries, where the result of
      pairwise-linestring-intersection is a mixed GeoSeries containing Points
      and LineStrings.
  
      The original offsets buffer at `pli[0]` refers to the geometry pair
      from which the feature intersections from `pli[1]` were computed. The new
      offsets buffer specifies the same thing, but now accounts for the missing
      values (either Points or LineStrings) that are present in `pli[1]` but
      missing in the `features` argument.
  
      See the docs for `_pli_points_to_multipoints` and
      `_pli_lines_to_multipoints` for the rest of the explanation.
      """
      in_sizes = (
          features.sizes
          if len(features) > 0
          else _zero_series(len(pli[0]) - 1)
      )
      offsets = cudf.Series(pli[0])
      offset_sizes = offsets[1:].reset_index(drop=True) - offsets[
          :-1
      ].reset_index(drop=True)
      in_indices = offset_sizes.index.repeat(offset_sizes)
      if len(in_indices) == 0:
          return _zero_series(len(pli[0]))
      # Just replacing the indices from the feature series with
      # the corresponding indices that are specified by the offsets buffer.
      # This is because cudf.Series.replace is extremely slow.
      in_sizes_df = in_sizes.reset_index()
      in_sizes_df.columns = ["index", "sizes"]
      sizes_replacement_series = cudf.Series(in_indices).reset_index()
      sizes_replacement_series.columns = ["index", "new_index"]
      new_in_sizes_index = in_sizes_df.merge(
          sizes_replacement_series, on="index"
      )
      in_sizes.index = new_in_sizes_index.sort_values("index")[
          "new_index"
      ]
  
      # Recompute the offsets for the new series
      grouped_sizes = in_sizes.groupby(level=0).sum().sort_index()
      out_sizes = _zero_series(len(pli[0]) - 1)
      out_sizes.iloc[grouped_sizes.index] = grouped_sizes
      offsets = cudf.concat([cudf.Series([0]), out_sizes.cumsum()])
      return offsets
  
imports: import cupy
  import numpy
  import cudf
  import cuspatial
  from cuspatial.core._column.geocolumn import ColumnType
  from cuspatial.core._column.geometa import Feature_Enum
label_desc: Use image node_id 23 for calling a global function with example usage: _pli_features_rebuild_offsets(pli, features) and returns: offsets, _zero_series