code: async def enter_bootloader(driver, model):
      
      # Required for old bootloader
      ports_before_dfu_mode = await _discover_ports()
  
      driver.enter_programming_mode()
      driver.disconnect()
      new_port = ''
      try:
          new_port = await asyncio.wait_for(
              _port_poll(_has_old_bootloader(model), ports_before_dfu_mode),
              PORT_SEARCH_TIMEOUT)
      except asyncio.TimeoutError:
          pass
      return new_port
docs: Using the driver method, enter bootloader mode of the atmega32u4.
      The bootloader mode opens a new port on the uC to upload the hex file.
      After receiving a 'dfu' command, the firmware provides a 3-second window to
      close the current port so as to do a clean switch to the bootloader port.
      The new port shows up as 'ttyn_bootloader' on the pi; upload fw through it.
      NOTE: Modules with old bootloader will have the bootloader port show up as
      a regular module port- 'ttyn_tempdeck'/ 'ttyn_magdeck' with the port number
      being either different or same as the one that the module was originally on
      So we check for changes in ports and use the appropriate one