<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _safe_exit(start, output):
 """ exit without breaking pipes """

    try:
        sys.stdout.write(output)
        sys.stdout.flush()
    except TypeError:  # python3
        sys.stdout.write(str(output, 'utf-8'))
        sys.stdout.flush()
    except IOError:
        pass

    seconds = time.time() - start
    print("\n\n%5.3f seconds" % (seconds), file=sys.stderr)