code: def get_device_info(self):
          device_info = {}
          url = '%s/ISAPI/System/deviceInfo' % self.root_url
          using_digest = False
          try:
              response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
              if response.status_code == requests.codes.unauthorized:
                  _LOGGING.debug('Basic authentication failed. Using digest.')
                  self.hik_request.auth = HTTPDigestAuth(self.usr, self.pwd)
                  using_digest = True
                  response = self.hik_request.get(url)
              if response.status_code == requests.codes.not_found:
                  _LOGGING.debug('Using alternate deviceInfo URL.')
                  url = '%s/System/deviceInfo' % self.root_url
                  response = self.hik_request.get(url)
                  if not using_digest and response.status_code == requests.codes.unauthorized:
                      _LOGGING.debug('Basic authentication failed. Using digest.')
                      self.hik_request.auth = HTTPDigestAuth(self.usr, self.pwd)
                      using_digest = True
                      response = self.hik_request.get(url)
          except (requests.exceptions.RequestException,
                  requests.exceptions.ConnectionError) as err:
              _LOGGING.error('Unable to fetch deviceInfo, error: %s', err)
              return None
          if response.status_code == requests.codes.unauthorized:
              _LOGGING.error('Authentication failed')
              return None
          if response.status_code != requests.codes.ok:
              _LOGGING.debug('Unable to fetch device info.')
              return None
          try:
              tree = ET.fromstring(response.text)
              nmsp = tree.tag.split('}')[0].strip('{')
              self.namespace = nmsp if nmsp.startswith('http') else XML_NAMESPACE
              _LOGGING.debug('Using Namespace: %s', self.namespace)
              for item in tree:
                  tag = item.tag.split('}')[1]
                  device_info[tag] = item.text
              return device_info
          except AttributeError as err:
              _LOGGING.error('Entire response: %s', response.text)
              _LOGGING.error('There was a problem: %s', err)
              return None