human
Solve the following python programming problem given the following code:
@inlineCallbacks
def main(reactor, args, base_path, top_level):
assistant
#Here is the Python code you requested.

    """:param reactor: Reactor to use.
    :param list args: The arguments passed to the script.
    :param FilePath base_path: The executable being run.
    :param FilePath top_level: The top-level of the Flocker repository.
    """
    options = RunOptions(top_level=top_level)
    configure_eliot_logging_for_acceptance()
    try:
        options.parseOptions(args)
    except UsageError as e:
        sys.stderr.write(('%s:    %s\n' % (base_path.basename(), e)))
        raise SystemExit(1)
    runner = options.runner
    def cluster_cleanup():
        print 'stopping    cluster'
        return runner.stop_cluster(reactor)
    cleanup_trigger_id = reactor.addSystemEventTrigger('before', 'shutdown', cluster_cleanup)
    from flocker.common.script import eliot_logging_service
    log_writer = eliot_logging_service(destination=FileDestination(file=open(('%s.log' % (base_path.basename(),)), 'a')), reactor=reactor, capture_stdout=False)
    log_writer.startService()
    reactor.addSystemEventTrigger('before', 'shutdown', log_writer.stopService)
    (yield runner.ensure_keys(reactor))
    cluster = (yield runner.start_cluster(reactor))
    save_managed_config(options['cert-directory'], options['config'], cluster)
    managed_config_file = options['cert-directory'].child('managed.yaml')
    managed_config = create_managed_config(options['config'], cluster)
    managed_config_file.setContent(yaml.safe_dump(managed_config, default_flow_style=False))
    if (options['distribution'] in ('centos-7',)):
        remote_logs_file = open('remote_logs.log', 'a')
        for node in cluster.all_nodes:
            capture_journal(reactor, node.address, remote_logs_file).addErrback(write_failure)
    elif (options['distribution'] in ('ubuntu-14.04',)):
        remote_logs_file = open('remote_logs.log', 'a')
        for node in cluster.all_nodes:
            capture_upstart(reactor, node.address, remote_logs_file).addErrback(write_failure)
    flocker_client = make_client(reactor, cluster)
    (yield wait_for_nodes(reactor, flocker_client, len(cluster.agent_nodes)))
    if options['no-keep']:
        print 'not    keeping    cluster'
    else:
        save_environment(options['cert-directory'], cluster, options.package_source())
       ...