<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reward_proximity(self):
 """ Add a wall proximity reward """

        if not 'proximity' in self.mode:
            return
        mode = self.mode['proximity']

        # Calculate proximity reward
        reward = 0
        for sensor in self.player.sensors:
            if sensor.sensed_type == 'wall':
                reward += sensor.proximity_norm()
            else:
                reward += 1

        reward /= len(self.player.sensors)
        #reward = min(1.0, reward * 2)
        reward = min(1.0, reward * reward)
        # TODO: Configurable bonus reward threshold. Pass extra args to `__test_cond`?
        #if mode and mode and reward > 0.75 and self.__test_cond(mode):
        if mode and mode and self.__test_cond(mode):
            # Apply bonus
            reward *= mode['reward']

        self.player.stats['reward'] += reward