<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shapes(self):
 """Return the route shapes as a dictionary."""

    # Todo: Cache?
    if self._shapes:
      return self._shapes
    # Group together by shape_id
    self.log("Generating shapes...")
    ret = collections.defaultdict(entities.ShapeLine)
    for point in self.read('shapes'):
      ret[point['shape_id']].add_child(point)
    self._shapes = ret
    return self._shapes