'Determine whether a compute instance is in one of the given states.
:param target_node: A libcloud node object representing the compute
instance to examine.
:param set target_states: The states to compare the compute instance\'s
actual state against.
:return: Deferred that fires with ``True`` if the compute instance is
currently in one of ``target_states``, ``False`` otherwise.'

def _async_node_in_state(self, reactor, target_node, target_states):

    d = self._async_refresh_node(reactor, target_node)
    def check_state(node):
        if (node is not None):
            if (node.state in target_states):
                Message.log(message_type=u'flocker:provision:libcloud:node_in_state', name=node.name, id=node.id, state=node.state)
                return True
        return False
    d.addCallback(check_state)
    return d
