code: def _valid_directory(self, path):
          
          abspath = os.path.abspath(path)
          if not os.path.isdir(abspath):
              raise argparse.ArgumentTypeError('Not a valid directory: {}'.format(abspath))
          return abspath
docs: Ensure that the given path is valid.
  
          :param str path: A valid directory path.
          :raises: :py:class:`argparse.ArgumentTypeError`
          :returns: An absolute directory path.