def isConnected(contourListNode):
    """Checks if the labels of the contours have a label in common. If (and onlly if)
    they all share a common object label, then they are connected and the function
    returns True"""

    intersectionOfLabelSets = contourListNode.children[0].object.labelSet
    for contourNode in contourListNode.children:
        intersectionOfLabelSets.intersection_update(contourNode.object.labelSet)

    if intersectionOfLabelSets:
        return True # set is not empty
    else:
        return False