code: def _check_order(types1, types2):
      """
      Helper to check that the loop types are ordered. The legacy type resolver
      (and potentially downstream) may pick use the first loop to which operands
      can be cast safely.
      """
      # Insert kK (int64) after all other ints (assumes long long isn't larger)
      dtype_order = bints + "kK" + times + flts + cmplxP + "O"
      for t1, t2 in zip(types1, types2):
          # We have no opinion on object or time ordering for now:
          if t1 in "OP" or t2 in "OP":
              return True
          if t1 in "mM" or t2 in "mM":
              return True
  
          t1i = dtype_order.index(t1)
          t2i = dtype_order.index(t2)
          if t1i < t2i:
              return
          if t2i > t1i:
              break
  
      if types1 == "QQ?" and types2 == "qQ?":
          # Explicitly allow this mixed case, rather than figure out what order
          # is nicer or how to encode it.
          return
  
      raise TypeError(
          f"Input dtypes are unsorted or duplicate: {types1} and {types2}"
      )
  
imports: import os
  import re
  import struct
  import sys
  import textwrap
  import argparse
  import string
label_desc: Use image node_id 1 for calling a global function with example usage: _check_order(types1, types2) and returns: True, True