code: def main():
      
      windows_libraries = list(pylink.Library.find_library_windows())
      latest_library = None
      for lib in windows_libraries:
          if os.path.dirname(lib).endswith('JLinkARM'):
              # Always use the one pointed to by the 'JLinkARM' directory.
              latest_library = lib
              break
          elif latest_library is None:
              latest_library = lib
          elif os.path.dirname(lib) > os.path.dirname(latest_library):
              latest_library = lib
  
      if latest_library is None:
          raise OSError('No J-Link library found.')
  
      library = pylink.Library(latest_library)
      jlink = pylink.JLink(lib=library)
  
      print('Found version: %s' % jlink.version)
  
      for emu in jlink.connected_emulators():
          jlink.disable_dialog_boxes()
          jlink.open(serial_no=emu.SerialNumber)
          jlink.sync_firmware()
          print('Updated emulator with serial number %s' % emu.SerialNumber)
  
      return None
docs: Upgrades the firmware of the J-Links connected to a Windows device.
  
      Returns:
        None.
  
      Raises:
        OSError: if there are no J-Link software packages.