def __init__(self, machine, name, config, collection=None, validate=True):
        self.log = logging.getLogger('playfield')

        self.machine = machine
        self.name = name.lower()
        self.tags = list()
        self.label = None
        self.debug = False
        self.config = dict()
        self._count_consistent = True
        self.unexpected_balls = 0

        if validate:
            self.config = self.machine.config_processor.process_config2(
                self.config_section, config, self.name)
        else:
            self.config = config

        if self.config['debug']:
            self.debug = True
            self.log.debug("Enabling debug logging for this device")
            self.log.debug("Configuring device with settings: '%s'", config)

        self.tags = self.config['tags']
        self.label = self.config['label']

        self.delay = DelayManager()

        self.machine.ball_devices[name] = self

        if self.config['tags'] in 'default':
            self.machine.playfield = self

        # Attributes
        self._balls = 0
        self.available_balls=0
        self.num_balls_requested = 0
        self.queued_balls = list()
        self._playfield = True

        # Set up event handlers

        # Watch for balls added to the playfield
        for device in self.machine.ball_devices:
            for target in device.config['eject_targets']:
                if target == self.name:
                    self.machine.events.add_handler(
                        event='balldevice_' + device.name +
                        '_ball_eject_success',
                        handler=self._source_device_eject_success)
                    self.machine.events.add_handler(
                        event='balldevice_' + device.name +
                        '_ball_eject_failed',
                        handler=self._source_device_eject_failed)
                    self.machine.events.add_handler(
                        event='balldevice_' + device.name +
                        '_ball_eject_attempt',
                        handler=self._source_device_eject_attempt)
                    break

        # Watch for balls removed from the playfield
        self.machine.events.add_handler('balldevice_captured_from_' + self.name,
                                        self._ball_removed_handler)

        # Watch for any switch hit which indicates a ball on the playfield
        self.machine.events.add_handler('sw_' + self.name + '_active',
                                        self.playfield_switch_hit)

        self.machine.events.add_handler('init_phase_2',
                                        self._initialize)
dataset/ETHPy150Open missionpinball/mpf/mpf/devices/playfield.py/Playfield.__init__/swapped operands of `in`