code: def find_shape(self, canvas_x, canvas_y):
          '''
          Look up shape based on canvas coordinates.
          '''
          shape_x, shape_y, w = self.canvas_to_shapes_transform.dot([canvas_x,
                                                                     canvas_y,
                                                                     1])
          if hasattr(self.space, 'point_query_first'):
              # Assume `pymunk<5.0`.
              shape = self.space.point_query_first((shape_x, shape_y))
          else:
              # Assume `pymunk>=5.0`, where `point_query_first` method has been
              # deprecated.
              info = self.space.point_query_nearest((shape_x, shape_y), 0,
                                                    [pymunk.ShapeFilter
                                                     .ALL_CATEGORIES])
              shape = info.shape if info else None
  
          if shape:
              return self.bodies[shape.body]
          return Nonf find_shape(self, canvas_x, canvas_y):
          '''
          Look up shape based on canvas coordinates.
          '''
          shape_x, shape_y, w = self.canvas_to_shapes_transform.dot([canvas_x,
                                                                     canvas_y,
                                                                     1])
          if hasattr(self.space, 'point_query_first'):
              # Assume `pymunk<5.0`.
              shape = self.space.point_query_first((shape_x, shape_y))
          else:
              # Assume `pymunk>=5.0`, where `point_query_first` method has been
              # deprecated.
              info = self.space.point_query_nearest((shape_x, shape_y), 0,
                                                    [pymunk.ShapeFilter
                                                     .ALL_CATEGORIES])
              shape = info.shape if info else None
  
          if shape:
              return self.bodies[shape.body]
          return None
docs: Look up shape based on canvas coordinates.