code: def test_sort_with_tag_bipartite(idtype):
      num_nodes, num_adj, num_tags = 200, [20, 50], 5
      g = create_test_heterograph(num_nodes, num_adj, idtype=idtype)
      g = dgl.heterograph({("_U", "_E", "_V"): g.edges()})
      utag = F.tensor(np.random.choice(num_tags, g.num_nodes("_U")))
      vtag = F.tensor(np.random.choice(num_tags, g.num_nodes("_V")))
  
      new_g = dgl.sort_csr_by_tag(g, vtag)
      old_csr = g.adj_external(scipy_fmt="csr")
      new_csr = new_g.adj_external(scipy_fmt="csr")
      assert check_sort(
          new_csr, vtag, new_g.nodes["_U"].data["_TAG_OFFSET"]
      )
      assert not check_sort(old_csr, vtag)
  
      new_g = dgl.sort_csc_by_tag(g, utag)
      old_csc = g.adj_external(transpose=True, scipy_fmt="csr")
      new_csc = new_g.adj_external(transpose=True, scipy_fmt="csr")
      assert check_sort(
          new_csc, utag, new_g.nodes["_V"].data["_TAG_OFFSET"]
      )
      assert not check_sort(old_csc, utag)
  
file_path: dgl/tests/python/common/transforms/test_functional-sort.py
imports: import itertools
  import unittest
  from collections import Counter
  import backend
  import dgl
  import dgl.function
  import networkx
  import numpy
  import pytest
  import scipy.sparse
  from dgl import DGLError
  from utils import parametrize_idtype
label_desc: Use image node_id 4 for calling a global function with example usage: test_sort_with_tag_bipartite(idtype) without return types