code: def available(self):
          
          if not self.adb_server_ip:
              # python-adb
              return bool(self._adb)
  
          # pure-python-adb
          try:
              # make sure the server is available
              adb_devices = self._adb_client.devices()
  
              # make sure the device is available
              try:
                  # case 1: the device is currently available
                  if any([self.host in dev.get_serial_no() for dev in adb_devices]):
                      if not self._available:
                          self._available = True
                      return True
  
                  # case 2: the device is not currently available
                  if self._available:
                      logging.error('ADB server is not connected to the device.')
                      self._available = False
                  return False
  
              except RuntimeError:
                  if self._available:
                      logging.error('ADB device is unavailable; encountered an error when searching for device.')
                      self._available = False
                  return False
  
          except RuntimeError:
              if self._available:
                  logging.error('ADB server is unavailable.')
                  self._available = False
              return False
docs: Check whether the ADB connection is intact.