code: def validate_pattern(fn):
      
      directory, pattern = parse_pattern(fn)
      if directory is None:
          print_err("Invalid pattern {}.".format(fn))
          return None, None
      target = resolve_path(directory)
      mode = auto(get_mode, target)
      if not mode_exists(mode):
          print_err("cannot access '{}': No such file or directory".format(fn))
          return None, None
      if not mode_isdir(mode):
          print_err("cannot access '{}': Not a directory".format(fn))
          return None, None
      return target, pattern
docs: On success return an absolute path and a pattern.
      Otherwise print a message and return None, None