human
Complete this python program:
def capture_upstart(reactor, host, output_file):
assistant
#Here is the Python program you requested.

    """SSH into given machine and capture relevant logs, writing them to
    output file.
    :param reactor: The reactor.
    :param bytes host: Machine to SSH into.
    :param file output_file: File to write to.
    :return deferred: that will run the tail command
    """
    results = []
    for (directory, service) in [('flocker', 'flocker-control'), ('flocker', 'flocker-dataset-agent'), ('flocker', 'flocker-container-agent'), ('flocker', 'flocker-docker-plugin'), ('upstart', 'docker')]:
        def pull_logs_for_process(directory=directory, service=service):
            path = FilePath('/var/log/').child(directory).child((service + '.log'))
            formatter = TailFormatter(output_file, host, service)
            ran = run_ssh(reactor=reactor, host=host, username='root', command=['tail', '-F', path.path], handle_stdout=formatter.handle_output_line)
            ran.addErrback(write_failure, logger=None)
            ran.addCallback((lambda ignored, formatter=formatter: formatter.handle_output_line('')))
            return ran
        results.append(loop_until(reactor, pull_logs_for_process, repeat(2.0)))
    return gather_deferreds(results)