code: def add_error_handler(self, error_input):
          
  
          if isinstance(error_input, dict):
              error_response = error_input.get('response', {})
              cerr = error_response.get('command_error', NoResponse)
              qerr = error_response.get('query_error', NoResponse)
  
              response_dict = {'command_error': cerr,
                               'query_error': qerr}
  
              register_list = error_input.get('status_register', [])
  
              for register_dict in register_list:
                  query = register_dict['q']
                  register = StatusRegister(register_dict)
                  self._status_registers[to_bytes(query)] = register
                  for key in register.keys():
                      self._error_map[key] = register
  
              queue_list = error_input.get('error_queue', [])
  
              for queue_dict in queue_list:
                  query = queue_dict['q']
                  err_queue = ErrorQueue(queue_dict)
                  self._error_queues[to_bytes(query)] = err_queue
  
          else:
              response_dict = {'command_error': error_input,
                               'query_error': error_input}
  
          for key, value in response_dict.items():
              self._error_response[key] = to_bytes(value)
docs: Add error handler to the device