code: def _deprecate_as_int(x, desc):
      try:
          return operator.index(x)
      except TypeError as e:
          try:
              ix = int(x)
          except TypeError:
              pass
          else:
              if ix == x:
                  warnings.warn(
                      "In future, this will raise TypeError, as {} will "
                      "need to be an integer not just an integral float.".format(
                          desc
                      ),
                      DeprecationWarning,
                      stacklevel=3,
                  )
                  return ix
  
          raise TypeError("{} must be an integer".format(desc)) from e
  
imports: import cupy
  import operator
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: _deprecate_as_int(x, desc) and returns: operator, ix