<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def IsDir(v):
 """Verify the directory exists. '/' """

    try:
        if v:
            v = str(v)
            return os.path.isdir(v)
        else:
            raise DirInvalid("Not a directory")
    except TypeError:
        raise DirInvalid("Not a directory")