Get object identifier

def get_object_id(obj):
    """Get object identifier"""
    try:
        idx = objIds.index(obj)
        return idx + 1
    except ValueError:
        objIds.append(obj)
        return len(objIds)