code: def GetPatternIdTripDict(self):
      
      d = {}
      for t in self._trips:
        d.setdefault(t.pattern_id, []).append(t)
      return d
docs: Return a dictionary that maps pattern_id to a list of Trip objects.