code: def order_terms(term_features, *args):
      if len(term_features) == 0:
          # in Python if only 1 item exists then the item is returned and not a tuple
          if len(args) == 0:
              return []
          else:
              return tuple([] for _ in range(len(args) + 1))
      keys = (
          [len(feature_idxs)] + sorted(feature_idxs)
          for feature_idxs in term_features
      )
      sorted_items = sorted(zip(keys, term_features, *args))
      ret = tuple(list(x) for x in islice(zip(*sorted_items), 1, None))
      # in Python if only 1 item exists then the item is returned and not a tuple
      return ret if 2 <= len(ret) else ret[0]
  
imports: from math import ceil, isnan, isinf, exp, log
  from ...utils._native import Native
  from ._tensor import restore_missing_value_zeros
  import numpy
  import warnings
  from itertools import islice
  import logging
label_desc: Use image node_id 8 for calling a global function with example usage: order_terms(term_features) and returns: unknown, list, tuple