<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def begin_scan(self, callback=None, interval=DEF_SCAN_INTERVAL, window=DEF_SCAN_WINDOW):
 """Begins a BLE scan and returns immediately. Using this method you can begin a BLE scan and leave the dongle in scanning mode in the background. It will remain in scanning mode until you call the :meth:`end_scan` method or the :meth:`reset` method. Args: callback (callbable):
 a callback that will be called for each new device discovered by the scanning process. Will be passed a single argument, a :class:`ScanResult` object. May be None if not needed. interval (int):
 BLE scan interval, in units of 625us window (int):
 BLE scan window, in units of 625us Returns: True on success, False otherwise. """


        # TODO validate params and current state
        logger.debug('configuring scan parameters') 
        self.api.ble_cmd_gap_set_scan_parameters(interval, window, 1)
        self._set_state(self._STATE_CONFIGURE_SCAN)
        self.api.ble_cmd_gap_discover(1) # any discoverable devices
        self._wait_for_state(self._STATE_CONFIGURE_SCAN)
        # TODO check state

        logger.debug('starting async scan for devices')
        self.scan_targets = None
        self.scan_callback = callback
        self._set_state(self._STATE_SCANNING)
        return True