human
Complete the below
def create_container(reactor, control_service, node_uuid, name, image, volumes=None, timeout=DEFAULT_TIMEOUT):

    ''''Create a container, then wait for it to be running.
    :param IReactorTime reactor: Twisted Reactor.
    :param IFlockerAPIV1Client control_service: Benchmark control
    service.
    :param UUID node_uuid: Node on which to start the container.
    :param unicode name: Name of the container.
    :param DockerImage image: Docker image for the container.
    :param Optional[Sequence[MountedDataset]] volumes: Volumes to attach
    to the container.
    :param timedelta timeout: Maximum time to wait for container to be
    created.
    :return Deferred[ContainerState]: The state of the created container.'
    '''
 Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    d = control_service.create_container(node_uuid, name, image, volumes)
    def wait_until_running(container):
        def container_matches(container, state):
            return ((container.name == state.name) and (container.node_uuid == state.node_uuid) and state.running)
        d = loop_until_state_found(reactor, control_service.list_containers_state, partial(container_matches, container), timeout)
        def delete_container(failure):
            d = control_service.delete_container(container.name)
            d.addCallback((lambda _ignore: failure))
            return d
        d.addErrback(delete_container)
        return d
    d.addCallback(wait_until_running)
    return d