def check_existing_dirpath(option, opt, value):
    if not exists(value):
        raise OptionValueError(
            "option %s: directory does not exist: %r" % (opt, value))
    elif not isdir(value):
        raise OptionValueError(
            "option %s: not a directory (can't be a file!): %r" % (opt, value))
    else:
        return value
dataset/ETHPy150Open biocore/pyqi/pyqi/core/interfaces/optparse/__init__.py/check_existing_dirpath/original