code: def _td_array_cmp(cls, op):
      """
      Wrap comparison operations to convert timedelta-like to timedelta64
      """
      opname = "__{name}__".format(name=op.__name__)
      nat_result = True if opname == "__ne__" else False
  
      def wrapper(self, other):
          if isinstance(
              other, (ABCDataFrame, ABCSeries, ABCIndexClass)
          ):
              return NotImplemented
  
          if _is_convertible_to_td(other) or other is NaT:
              try:
                  other = Timedelta(other)
              except ValueError:
                  # failed to parse as timedelta
                  return ops.invalid_comparison(self, other, op)
  
              result = op(self.view("i8"), other.value)
              if isna(other):
                  result.fill(nat_result)
  
          elif not is_list_like(other):
              return ops.invalid_comparison(self, other, op)
  
          elif len(other) != len(self):
              raise ValueError("Lengths must match")
  
          else:
              try:
                  other = type(self)._from_sequence(other)._data
              except (ValueError, TypeError):
                  return ops.invalid_comparison(self, other, op)
  
              result = op(self.view("i8"), other.view("i8"))
              result = com.values_from_object(result)
  
              o_mask = np.array(isna(other))
              if o_mask.any():
                  result[o_mask] = nat_result
  
          if self._hasnans:
              result[self._isnan] = nat_result
  
          return result
  
      return compat.set_function_name(wrapper, opname, cls)
  
imports: from __future__ import division
  from datetime import timedelta
  import textwrap
  import warnings
  import numpy
  from pandas._libs import lib, tslibs
  from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT
  from pandas._libs.tslibs.fields import get_timedelta_field
  from pandas._libs.tslibs.timedeltas import array_to_timedelta64, parse_timedelta_unit, precision_from_unit
  import pandas.compat
  from pandas.util._decorators import Appender
  from pandas.core.dtypes.common import _NS_DTYPE, _TD_DTYPE, ensure_int64, is_datetime64_dtype, is_dtype_equal, is_float_dtype, is_integer_dtype, is_list_like, is_object_dtype, is_scalar, is_string_dtype, is_timedelta64_dtype, is_timedelta64_ns_dtype, pandas_dtype
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries, ABCTimedeltaIndex
  from pandas.core.dtypes.missing import isna
  from pandas.core import ops
  from pandas.core.algorithms import checked_add_with_arr
  import pandas.core.common
  from pandas.tseries.frequencies import to_offset
  from pandas.tseries.offsets import Tick
  from .None import datetimelike
label_desc: Use image node_id 3 for calling a global function with example usage: _td_array_cmp(cls, op) and returns: compat, result, NotImplemented, ops, ops, ops