def get_complex_and_node_state(self, hosts, services):
        """Get state , handle AND aggregation ::

           * Get the worst state. 2 or max of sons (3 <=> UNKNOWN < CRITICAL <=> 2)
           * Revert if it's a not node

        :param hosts: host objects
        :param services: service objects
        :return: 0, 1 or 2
        :rtype: int
        """
        # First we get the state of all our sons
        states = [s.get_state(hosts, services) for s in self.sons]
        # Next we calculate the worst state
        if 2 in states:
            worst_state = 2
        else:
            worst_state = max(states)
        # Then we handle eventual not value
        if self.not_value:
            return self.get_reverse_state(worst_state)
        return worst_state
def get_complex_and_node_state ( self , hosts , services ) : states = [ s . get_state ( hosts , services ) for s in self . sons ] if 2 in states : worst_state = 2 else : worst_state = max ( states ) if self . not_value : return self . get_reverse_state ( worst_state ) return worst_state
Get state , handle AND aggregation ::

           * Get the worst state. 2 or max of sons (3 <=> UNKNOWN < CRITICAL <=> 2)
           * Revert if it's a not node

        :param hosts: host objects
        :param services: service objects
        :return: 0, 1 or 2
        :rtype: int