code: def reboot_adb_server():
      
      _reboot_count = 0
      _max_retry = 1
  
      def _reboot():
          nonlocal _reboot_count
          if _reboot_count >= _max_retry:
              raise RuntimeError('fail after retry {} times'.format(_max_retry))
          _reboot_count += 1
  
          return_code = subprocess.call(['adb', 'devices'], stdout=subprocess.DEVNULL)
          if bool(return_code):
              warnings.warn('return not zero, execute "adb version" failed')
              raise EnvironmentError('adb did not work :(')
  
      return _reboot
docs: execute 'adb devices' to start adb server