def getCompoundAttrIndex(childAttr):
    """
    Return the index of the given compound child attribute.

    Args:
        childAttr (Attribute): An attribute that is the child of a compount attr
    """
    if not childAttr.isChild():
        raise ValueError("Attribute is not a child of a "
                         "compound attribute: {0}".format(childAttr))
    return childAttr.getParent().getChildren().index(childAttr)