code: def _maybe_keepdims(chunk, res):
      out_chunk = (
          chunk.composed[-1]
          if type(chunk.op) == TensorNeFuseChunk
          else chunk
      )
      if (
          type(out_chunk.op) in NE_REDUCTION_TO_STRING
          and out_chunk.op.keepdims
      ):
          res = np.reshape(res, out_chunk.shape)
      return res
  
imports: from collections import defaultdict
  from itertools import count
  import numpy
  from ..operands import TensorFuse
  from ..None import arithmetic, reduction
  from ..array_utils import as_same_device
  from .core import TensorFuseChunkMixin
label_desc: Use image node_id 8 for calling a global function with example usage: _maybe_keepdims(chunk, res) and returns: res