code: def run(self, args):
          
          jlink = self.create_jlink(args)
          if args.downgrade:
              if not jlink.firmware_newer():
                  print('DLL firmware is not older than J-Link firmware.')
              else:
                  jlink.invalidate_firmware()
  
                  try:
                      # Change to the firmware of the connected DLL.
                      jlink.update_firmware()
                  except pylink.JLinkException as e:
                      # On J-Link versions < 5.0.0, an exception will be thrown as
                      # the connection will be lost, so we have to re-establish.
                      jlink = self.create_jlink(args)
  
                  print('Firmware Downgraded: %s' % jlink.firmware_version)
          elif args.upgrade:
              if not jlink.firmware_outdated():
                  print('DLL firmware is not newer than J-Link firmware.')
              else:
                  try:
                      # Upgrade the firmware.
                      jlink.update_firmware()
                  except pylink.JLinkException as e:
                      # On J-Link versions < 5.0.0, an exception will be thrown as
                      # the connection will be lost, so we have to re-establish.
                      jlink = self.create_jlink(args)
                  print('Firmware Updated: %s' % jlink.firmware_version)
  
          return None
docs: Runs the firmware command.
  
          Args:
            self (FirmwareCommand): the ``FirmwareCommand`` instance
            args (Namespace): arguments to parse
  
          Returns:
            ``None``