code: def test_sort_by(setup):
      rs = np.random.RandomState(0)
      raw1 = rs.rand(10)
      raw2 = rs.rand(10)
      raw3 = rs.rand(10)
  
      a1 = mt.tensor(raw1, chunk_size=4)
      a2 = mt.tensor(raw2, chunk_size=4)
      a3 = mt.tensor(raw3, chunk_size=4)
  
      s1, s2 = sort_by([a1, a2], by=a3)
      ind = np.argsort(raw3)
      e1, e2 = raw1[ind], raw2[ind]
      np.testing.assert_array_equal(s1, e1)
      np.testing.assert_array_equal(s2, e2)
  
      s1, s2 = sort_by([a1, a2], by=a2, ascending=False)
      ind = np.argsort(raw2)[::-1]
      e1, e2 = raw1[ind], raw2[ind]
      np.testing.assert_array_equal(s1, e1)
      np.testing.assert_array_equal(s2, e2)
  
imports: import numpy
  from ....None import tensor
  from ..core import sort_by
label_desc: Use image node_id 1 for calling a global function with example usage: test_sort_by(setup) without return types