def print_and_exit(results):
    """Print each result and stop the reactor."""
    for success, value in results:
        if success:
            print value.encode(locale.getpreferredencoding())
        else:
            value.printTraceback()