code: def _check_first_and_last_rank_elements_are_equal(rank):
      if rank[0] != rank[-1]:
          message = (
              f"Provided rank[0] == {rank[0]} and rank[-1] == {rank[-1]} "
              "but boundary conditions dictate rank[0] == rank[-1]."
          )
          raise ValueError(message)
  
imports: from typing import Union, Tuple, Optional, Sequence, Iterable, Generator
  import warnings
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
  from ivy.func_wrapper import outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_out_argument, infer_dtype, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_backend_invalid, handle_array_function
label_desc: Use image node_id 18 for calling a global function with example usage: _check_first_and_last_rank_elements_are_equal(rank) without return types