def choose_device(self: Union['QtPluginBase', HW_PluginBase], window: 'ElectrumWindow',
                      keystore: 'Hardware_KeyStore') -> Optional[str]:
        '''This dialog box should be usable even if the user has
        forgotten their PIN or it is in bootloader mode.'''
        assert window.gui_thread != threading.current_thread(), 'must not be called from GUI thread'
        device_id = self.device_manager().id_by_pairing_code(keystore.pairing_code())
        if not device_id:
            try:
                info = self.device_manager().select_device(self, keystore.handler, keystore)
            except UserCancelled:
                return
            device_id = info.device.id_
        return device_id
This dialog box should be usable even if the user has
        forgotten their PIN or it is in bootloader mode.
electrum/hw_wallet/qt.py