code: def assert_index_equal(first, second, strict=True, ordered=True):
      assert len(first) == len(
          second
      ), "Index have different no. of stages"
      assert set(first) == set(
          second
      ), "Index does not have same stages"
      if ordered:
          assert list(first) == list(
              second
          ), "Index does not have same sequence of stages"
      if strict:
          assert set(map(id, first)) == set(
              map(id, second)
          ), "Index is not strictly equal"
  
imports: import os
  from itertools import chain
  import pytest
  from pygtrie import Trie
  from dvc.repo.index import Index
  from dvc.stage import Stage
label_desc: Use image node_id 6 for calling a global function with example usage: assert_index_equal(first, second, strict, ordered) without return types