human
Complete this python program:
def conditional_create(client, reactor, condition, *args, **kwargs):
assistant
#Here is the Python code you requested.

    """Create a dataset only if a certain condition is true for the
    configuration.
    This is useful for ensuring e.g. uniqueness of metadata across
    datasets. Conditional creation will be used to ensure that if the
    configuration changes the create won\t happen; in this case the whole
    check-and-create will be retried, up to 20 times.
    All parameters are the same as
    ``IFlockerAPIV1Client.create_dataset_configuration`` except the
    following:
    :param client: ``IFlockerAPIV1Client`` provider.
    :param reactor: ``IReactorTime`` provider.
    :param condition: Callable which will be called with the current
    ``DatasetsConfiguration`` retrieved from the server. If this
    raises an exception then the create will be aborted.
    :return: ``Deferred`` firing with resulting ``Dataset`` if creation
    succeeded, or the relevant exception if creation failed.
    """
    context = _LOG_CONDITIONAL_CREATE()
    def create():
        d = client.list_datasets_configuration()
        def got_config(config):
            condition(config)
            return deferLater(reactor, 0.001, context.run, client.create_dataset, configuration_tag=config.tag, *args, **kwargs)
        d.addCallback(got_config)
        return d
    with context.context():
        result = DeferredContext(retry_failure(reactor, create, [ConfigurationChanged], ([0.001] * 19)))
        result.addActionFinish()
        return result.result