<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _valid_directory(self, path):
 """Ensure that the given path is valid. :param str path: A valid directory path. :raises: :py:class:`argparse.ArgumentTypeError` :returns: An absolute directory path. """

        abspath = os.path.abspath(path)
        if not os.path.isdir(abspath):
            raise argparse.ArgumentTypeError('Not a valid directory: {}'.format(abspath))
        return abspath