def verifyWriteMode(files):
    """
    Checks whether files are writable. It is up to the calling routine to raise
    an Exception, if desired.

    This function returns True, if all files are writable and False, if any are
    not writable.  In addition, for all files found to not be writable, it will
    print out the list of names of affected files.
    """
    if not isinstance(files, list):
        files = [files]
    not_writable = []
    writable = True
    for fname in files:
        try:
            f = open(fname, 'a')
            f.close()
            del f
        except:
            not_writable.append(fname)
            writable = False
    if not writable:
        print('The following file(s) do not have write permission!')
        for fname in not_writable:
            print('    ', fname)
    return writable
