def is_output_directory_valid(filename): if os.path.exists(filename): raise argparse.ArgumentTypeError("The output directory already exists") return filename