code: def _path_has_ok_chars(path):
      
      basename = os.path.basename(path)
      if any([bad_char in basename for bad_char in INVALID_PATH_CHARS]):
              raise argparse.ArgumentTypeError("{} contains invalid characters for a directory.".format(path))
      return path
docs: Validate path for invalid characters.
      :param path: str possible filesystem path
      :return: path if it was ok otherwise raises error