code: def get_state(self, hosts, services):
          
          # If we are a host or a service, we just got the host/service
          # hard state
          if self.operand == 'host':
              host = hosts[self.sons[0]]
              return self.get_host_node_state(host.last_hard_state_id,
                                              host.problem_has_been_acknowledged,
                                              host.in_scheduled_downtime)
          if self.operand == 'service':
              service = services[self.sons[0]]
              return self.get_service_node_state(service.last_hard_state_id,
                                                 service.problem_has_been_acknowledged,
                                                 service.in_scheduled_downtime)
          if self.operand == '|':
              return self.get_complex_or_node_state(hosts, services)
  
          if self.operand == '&':
              return self.get_complex_and_node_state(hosts, services)
  
          #  It's an Xof rule
          if self.operand == 'of:':
              return self.get_complex_xof_node_state(hosts, services)
  
          # We have an unknown node. Code is not reachable because we validate operands
          return 4
docs: Get node state by looking recursively over sons and applying operand
  
          :param hosts: list of available hosts to search for
          :param services: list of available services to search for
          :return: Node state
          :rtype: int