def is_subdir_of(ospath, parent, child):
    """

    >>> is_subdir_of(os.path, "/a/b/c", "/a/b/c/d")
    True
    >>> is_subdir_of(os.path, "/a/b/c", "/a/b/d")
    False
    >>> is_subdir_of(os.path, "/a/b/c", "/a/b/c/../d")
    False
    """

    nparent = ospath.normpath(parent.rstrip(ospath.sep))
    nchild = ospath.normpath(child)

    common = ospath.commonpath([nparent, nchild])
    return nparent == common