Return the index position of an element in the children of a parent.

def index(elem):
    '''
    Return the index position of an element in the children of a parent.
    '''
    parent = elem.getparent()
    for x in range(0, len(parent.getchildren())):
        if parent.getchildren()[x] == elem:
            return x
    return -1