'Poll the container state API until a container exists with all the
supplied ``container_properties``.
:param dict container_properties: The attributes of the container that
we\'re waiting for. All the keys, values and those of nested
dictionaries must match.
:returns: A ``Deferred`` which fires with an API response when a
container with the supplied properties appears in the cluster.'

@log_method
def wait_for_container(self, container_properties):

    def created():
        '\n                                                Check    the    container    state    list    for    the    expected    container\n                                                properties.\n                                                '
        request = self.current_containers()
        def got_response(containers):
            expected_container = container_properties.copy()
            for container in containers:
                container_items = container.items()
                if all([(item in container_items) for item in expected_container.items()]):
                    return container
            return False
        request.addCallback(got_response)
        return request
    return loop_until(reactor, created)
