code: def _infer_ref_minibatch_size_from_legacy_use_mean_gradient(
      ref_minibatch_size, use_mean_gradient
  ):
      if (ref_minibatch_size, use_mean_gradient) == (None, None):
          # if ref_minibatch_size and the legacy use_mean_gradient are neither specified
          return None
      if ref_minibatch_size is not None:
          if (
              use_mean_gradient == True
              and ref_minibatch_size
              != cntk_py.Learner.ignored_minibatch_size
          ):
              Warning(
                  "Learner reference minibatch size is specified while use_mean_gradient (depreated option) is specified to True. Learner reference minibatch size will override the mean gradient behavior"
              )
          # if the ref_minibatch_size is specified, it overrides the legacay use_mean_gradient specification
          return ref_minibatch_size
      elif use_mean_gradient is not None:
          # if the ref_minibatch_size is NOT specified, the legacay use_mean_gradient specification take in the effect
          return (
              cntk_py.Learner.ignored_minibatch_size
              if use_mean_gradient is True
              else None
          )
      return None
  
imports: from enum import Enum, unique
  import warnings
  import numpy
  import cntk.internal.utils
  from ..None import cntk_py, NDArrayView, asarray
  from cntk.internal import typemap
  from ..internal.swig_helper import map_if_possible
label_desc: Use image node_id 13 for calling a global function with example usage: _infer_ref_minibatch_size_from_legacy_use_mean_gradient(ref_minibatch_size, use_mean_gradient) and returns: None, None, ref_minibatch_size, unknown