code: def sort_all(batch, lens):
      """Sort all fields by descending order of lens, and return the original indices."""
      if batch == [[]]:
          return [[]], []
      unsorted_all = [lens] + [range(len(lens))] + list(batch)
      sorted_all = [
          list(t)
          for t in zip(*sorted(zip(*unsorted_all), reverse=True))
      ]
      return sorted_all[2:], sorted_all[1]
  
file_path: stanza/stanza/models/common/data.py
imports: import logging
  import random
  import torch
  import stanza.models.common.seq2seq_constant
  from stanza.models.common.doc import HEAD, ID, UPOS
label_desc: Use image node_id 4 for calling a global function with example usage: sort_all(batch, lens) and returns: sorted_all,  sorted_all, list,  list