code: def _comparator_builder(op_type, is_max_k):
      c = xc.XlaBuilder(
          "top_k_{}_comparator".format("gt" if is_max_k else "lt")
      )
      p0 = xla.parameter(c, 0, xc.Shape.scalar_shape(op_type))
      p1 = xla.parameter(c, 1, xc.Shape.scalar_shape(op_type))
      xla.parameter(c, 2, xc.Shape.scalar_shape(np.dtype(np.int32)))
      xla.parameter(c, 3, xc.Shape.scalar_shape(np.dtype(np.int32)))
      if is_max_k:
          cmp_result = xc.ops.Gt(p0, p1)
      else:
          cmp_result = xc.ops.Lt(p0, p1)
      return c.build(cmp_result)
  
imports: from functools import partial
  import numpy
  from jax._src import ad_util
  from jax._src import core
  from jax._src import dispatch
  from jax._src import dtypes
  from jax._src.interpreters import ad
  from jax._src.interpreters import batching
  from jax._src.interpreters import mlir
  from jax._src.interpreters import xla
  from jax._src.lax import lax
  from jax._src.lib import xla_client
  from jax._src.lib.mlir import ir
  from jax._src.lib.mlir.dialects import func
  from jax._src.lib.mlir.dialects import hlo
  from jax._src.typing import Array
label_desc: Use image node_id 4 for calling a global function with example usage: _comparator_builder(op_type, is_max_k) and returns: c