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. hvd.allreduce(tensor, average=False))
      gets unchanged behavior, but mixing old and new is disallowed (e.g. no
      hvd.allreduce(tensor, average=False, op=hvd.Adasum)).
      """
  
      def impl(op, average):
          if op is not None:
              if average is not None:
                  raise ValueError(
                      "The op parameter supersedes average. Please provide only one of them."
                  )
              return op
          elif average is not None:
              warnings.warn(
                  "Parameter `average` has been replaced with `op` and will be removed in v1.0",
                  DeprecationWarning,
              )
              return reduce_ops.Average if average else reduce_ops.Sum
          else:
              return reduce_ops.Average
  
      return impl
  
imports: import json
  import multiprocessing
  import os
  import sys
  import sysconfig
  import warnings
  from contextlib import contextmanager
  from horovod.common.exceptions import get_version_mismatch_message, HorovodVersionMismatchError
label_desc: Use image node_id 14 for calling a global function with example usage: get_average_backwards_compatibility_fun(reduce_ops) and returns: impl, op, unknown, reduce_ops