code: def add_item(self, radius, item_type):
          
          assert isinstance(radius, int) or isinstance(radius, float)
          assert isinstance(item_type, str)
  
          separation_scale = 1.1
          min_separation = separation_scale * radius
  
          # Removable item
          item = Collidable(0, 0, radius, item_type, self.pics[item_type], True)
          cntTrys = 0
          while cntTrys < 100:
              cx = radius + random.random() * (self.width - 2.0 * radius)
              cy = radius + random.random() * (self.height - 2.0 * radius)
  
              # Test if colliding with wall.
              # Top left
              cells = []
              cells.append(self.map_layer.get_at_pixel(cx-radius, cy-radius))
              # Top right
              cells.append(self.map_layer.get_at_pixel(cx+radius, cy-radius))
              # Bottom  left
              cells.append(self.map_layer.get_at_pixel(cx-radius, cy+radius))
              # Bottom  right
              cells.append(self.map_layer.get_at_pixel(cx+radius, cy+radius))
  
              wall = False
              for cell in cells:
                  wall = cell and cell.tile and cell.tile.id > 0
                  if wall:
                      break
  
              if wall:
                  continue
  
              item.update_center(eu.Vector2(cx, cy))
              if self.collman.any_near(item, min_separation) is None:
                  self.add(item, z=self.z)
                  self.z += 1
                  self.collman.add(item)
                  break
              cntTrys += 1
docs: Add a single item in random open position