code: def test_sort_losses():
      samples = [
          _set_losses_lrc(
              {"stuff": 0.2, "loss_total": 2, "text": "text2"}
          ),
          _set_losses_lrc(
              {"stuff": 0.1, "loss_total": 1, "text": "text1"}
          ),
          _set_losses_lrc(
              {"stuff": 0.3, "loss_total": 3, "text": "text3"}
          ),
      ]
  
      preds = [
          {"stuff": 0.1, "pred": 1},
          {"stuff": 0.2, "pred": 2},
          {"stuff": 0.3, "pred": 3},
      ]
  
      sorted_samples_ex = [
          {"stuff": 0.3, "loss_total": 3, "text": "text3"},
          {"stuff": 0.2, "loss_total": 2, "text": "text2"},
          {"stuff": 0.1, "loss_total": 1, "text": "text1"},
      ]
  
      sorted_preds_ex = [
          {"stuff": 0.3, "pred": 3},
          {"stuff": 0.1, "pred": 1},
          {"stuff": 0.2, "pred": 2},
      ]
  
      sorted_samples, sorted_preds, annotations = models.sort_losses(
          samples, preds
      )
  
      assert [s.losses for s in sorted_samples] == sorted_samples_ex
      assert sorted_preds == sorted_preds_ex
      assert annotations == ["text3", "text2", "text1"]
  
file_path: icevision/tests/utils/test_utils.py
imports: from icevision.all import *
  from icevision.core.record_components import LossesRecordComponent
label_desc: Use image node_id 10 for calling a global function with example usage: test_sort_losses() without return types