def filename_arg(path, optname):
if os.path.isdir(path):<EOL><INDENT>raise UsageError("<STR_LIT>".format(optname, path))<EOL><DEDENT>return path<EOL>
Argparse type validator for filename arguments.

    :path: path of filename
    :optname: name of the option