import itertools


def firstOpenIndex(attribute):
    """Returns the first open (non-connected) index of the given array attribute."""
    for i in itertools.count():
        entry = attribute[i]
        if not entry.listConnections():
            return i