def not_none_dim(rel):
    """ Returns the index of dimension which is not None (which is 1/-1) in rel
    Index is 0 based: 0 is right/left, 1 is front/back, 2 is above/below. """
    for index, element in enumerate(rel):
        if element == 1:
            return index
        continue
    # Should never reach here: None only on error
    return None