def returner(ret):
    '''
    Check highstate return information and possibly fire off an email
    or save a file.
    '''
    setup = _get_options(ret)

    log.debug('highstate setup %s', setup)

    report, failed = _generate_report(ret, setup)
    if report:
        _produce_output(report, failed, setup)
Check highstate return information and possibly fire off an email
    or save a file.