docs: def build_shapes(pfeed):
      """
      Given a ProtoFeed, return DataFrame representing ``shapes.txt``.
      Only use shape IDs that occur in both ``pfeed.shapes`` and
      ``pfeed.frequencies``.
      Create reversed shapes where routes traverse shapes in both
      directions.
      """
      rows = []
      for shape, geom in pfeed.shapes[['shape_id',
        'geometry']].itertuples(index=False):
          if shape not in pfeed.shapes_extra:
              continue
          if pfeed.shapes_extra[shape] == 2:
              # Add shape and its reverse
              shid = shape + '-1'
              new_rows = [[shid, i, lon, lat]
                for i, (lon, lat) in enumerate(geom.coords)]
              rows.extend(new_rows)
              shid = shape + '-0'
              new_rows = [[shid, i, lon, lat]
                for i, (lon, lat) in enumerate(reversed(geom.coords))]
              rows.extend(new_rows)
          else:
              # Add shape
              shid = '{}{}{}'.format(shape, cs.SEP, pfeed.shapes_extra[shape])
              new_rows = [[shid, i, lon, lat]
                for i, (lon, lat) in enumerate(geom.coords)]
              rows.extend(new_rows)
  
      return pd.DataFrame(rows, columns=['shape_id', 'shape_pt_sequence',
        'shape_pt_lon', 'shape_pt_lat'])