def METHOD_NAME(pnode, key, value):
    '''
    Assuming that the key is unique, walk the current path and see how
    many times "key" has the specified value.  This will be how many instances
    of a loop have been encountered.
    '''
    count = 0
    parent = pnode
    while parent is not None:
        parent, kids, props = parent
        if props.get(key) == value:
            count += 1
    return count