code: def reduce_shape(shape, axis=None, keepdims=False):
      shape = list(shape)
      if axis is None:
          if keepdims:
              return tuple([1 for _ in shape])
          else:
              return tuple([])
  
      if keepdims:
          for ax in axis:
              shape[ax] = 1
          return tuple(shape)
      else:
          for ax in sorted(axis, reverse=True):
              del shape[ax]
          return tuple(shape)
  
file_path: keras/keras/ops/operation_utils.py
imports: import math
  import numpy
  import tree
  from keras.api_export import keras_export
label_desc: Use image node_id 8 for calling a global function with example usage: reduce_shape(shape, axis, keepdims) and returns: tuple, tuple, tuple, tuple