def _tot_hosts_by_state(self, state=None, state_type=None):
        """Generic function to get the number of host in the specified state

        :param state: state to filter on
        :type state: str
        :param state_type: state type to filter on (HARD, SOFT)
        :type state_type: str
        :return: number of host in state *state*
        :rtype: int
        """
        if state is None and state_type is None:
            return len(self.hosts)
        if state_type:
            return sum(1 for h in self.hosts if h.state == state and h.state_type == state_type)
        return sum(1 for h in self.hosts if h.state == state)
Generic function to get the number of host in the specified state

        :param state: state to filter on
        :type state: str
        :param state_type: state type to filter on (HARD, SOFT)
        :type state_type: str
        :return: number of host in state *state*
        :rtype: int