'Create AMP client that can respond successfully to a
``NodeStateCommand``.
:param local_states: The node states we expect to be able to send.
:param successes: List indicating whether the response to the
corresponding states should fail.  ``True`` to make a client which
responds to requests with results, ``False`` to make a client which
response with failures. Defaults to always succeeding.
:type successes: ``None`` or ``list`` of ``bool``
:return FakeAMPClient: Fake AMP client appropriately setup.'

def make_amp_client(self, local_states, successes=None):

    client = FakeAMPClient()
    command = NodeStateCommand
    if (successes is None):
        successes = repeat(True)
    for (local_state, success) in zip(local_states, successes):
        kwargs = dict(state_changes=(local_state,))
        if success:
            client.register_response(command=command, kwargs=kwargs, response={'result': None})
        else:
            client.register_response(command=command, kwargs=kwargs, response=Exception('Simulated    request    problem'))
    return client
