code: def get_service_node_state(self, state, problem_has_been_acknowledged, in_scheduled_downtime):
          
          # If our node is acknowledged or in downtime, state is ok/up
          if problem_has_been_acknowledged or in_scheduled_downtime:
              state = 0
  
          # Maybe we are a NOT node, so manage this
          if self.not_value:
              # Critical -> OK
              if state == 2:
                  return 0
              # OK -> CRITICAL (warning is untouched)
              if state == 0:
                  return 2
          return state
docs: Get service node state, simplest case ::
  
          * Handle not value (revert) for service
  
          :return: 0, 1 or 2
          :rtype: int