'Whether this path is a directory.'

def is_dir(self):

    try:
        return S_ISDIR(self.stat().st_mode)
    except OSError as e:
        if (e.errno not in (ENOENT, ENOTDIR)):
            raise
        return False
