code: def validated_package(path: str) -> u.Package:
      """similar to generate_package but runs argparse validation on packages that
      don't actually exist in the filesystem.
  
      """
      p = ufs.generate_package(path)
  
      if not os.path.isdir(p.package_path):
          raise argparse.ArgumentTypeError(
              """Directory '{}' doesn't exist in directory. Code must be
  nested in a folder that exists in the current directory.""".format(
                  p.package_path
              )
          )
  
      filename = p.script_path
      if not ufs.file_exists_in_cwd(filename):
          raise argparse.ArgumentTypeError(
              """File '{}' doesn't exist locally as a script or python module; code
  must live inside the current directory.""".format(
                  filename
              )
          )
  
      return p
  
file_path: caliban/caliban/util/argparse.py
imports: import argparse
  import itertools
  import os
  from typing import Dict, List, Optional, Tuple
  from blessings import Terminal
  import caliban.util
  import caliban.util.fs
  import schema
label_desc: Use image node_id 3 for calling a global function with example usage: validated_package(path) and returns: p