def write_output(filename, output):
    """Write the program output to a file"""
    try:
        with open(filename, 'w') as outfile_handler:
            outfile_handler.write(output)
    except OSError:
        raise OSError('Unable to write output file %s' % filename)
