async def _port_poll(is_old_bootloader, ports_before_switch=None):
    """
    Checks for the bootloader port
    """
    new_port = ''
    while not new_port:
        if is_old_bootloader:
            new_port = await _port_on_mode_switch(ports_before_switch)
        else:
            ports = await _discover_ports()
            if ports:
                discovered_ports = list(filter(
                    lambda x: x.endswith('bootloader'), ports))
                if len(discovered_ports) == 1:
                    new_port = '/dev/modules/{}'.format(discovered_ports[0])
        await asyncio.sleep(0.05)
    return new_port
async def _port_poll ( is_old_bootloader , ports_before_switch = None ) : new_port = '' while not new_port : if is_old_bootloader : new_port = await _port_on_mode_switch ( ports_before_switch ) else : ports = await _discover_ports ( ) if ports : discovered_ports = list ( filter ( lambda x : x . endswith ( 'bootloader' ) , ports ) ) if len ( discovered_ports ) == 1 : new_port = '/dev/modules/{}' . format ( discovered_ports [ 0 ] ) await asyncio . sleep ( 0.05 ) return new_port
Checks for the bootloader port