code: def get_average_backwards_compatibility_fun(reduce_ops):
      """
      Handle backwards compatibility between the old average and the new op parameters.
      Old code using the average parameter (e.g. bps.PushPull(tensor, average=False))
      gets unchanged behavior, but mixing old and new is disallowed (e.g. no
      bps.PushPull(tensor, average=False, op=bps.Adasum)).
      """
  
      def impl(op, average):
          if op != None:
              if average != None:
                  raise ValueError(
                      "The op parameter supersedes average. Please provide only one of them."
                  )
              return op
          elif average != None:
              warnings.warn(
                  "Parameter `average` has been replaced with `op` and will be removed",
                  DeprecationWarning,
              )
              return reduce_ops.Average if average else reduce_ops.Sum
          else:
              return reduce_ops.Average
  
      return impl
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import re
  import os
  import ctypes
  from enum import Enum
  import random
  import string
  import warnings
  from tensorflow.python.framework import load_library
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import resource_loader
  from byteps.common import get_ext_suffix
  from byteps.common import BytePSBasics
  from byteps.tensorflow.util import _executing_eagerly
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_average_backwards_compatibility_fun(reduce_ops) and returns: impl, op, unknown, reduce_ops