code: def owned_expansions(self):
          
  
          owned = {}
          for el in self.expansion_locations:
              def is_near_to_expansion(t):
                  return t.position.distance_to(el) < self.EXPANSION_GAP_THRESHOLD
  
              th = next((x for x in self.townhalls if is_near_to_expansion(x)), None)
              if th:
                  owned[el] = th
  
          return owned
docs: List of expansions owned by the player.