def all_the_same(pointer, length, id_list):
    """
    :param pointer: starting from that element the list is being checked for equality of its elements
    :param length:
    :param id_list: List mustn't be empty or Null. There has to be at least one element
    :return: returns the first encountered element if starting from the pointer all elements are the same,
     otherwise it returns -1
    """
    element = id_list[pointer]
    pointer += 1
    while pointer < length:
        if element != id_list[pointer]:
            return -1
        pointer += 1
    return element
:param pointer: starting from that element the list is being checked for equality of its elements
    :param length:
    :param id_list: List mustn't be empty or Null. There has to be at least one element
    :return: returns the first encountered element if starting from the pointer all elements are the same,
     otherwise it returns -1