code: def _process_gradient_args(f, kwargs):
      
      axes = kwargs.get('axes', range(f.ndim))
  
      def _check_length(positions):
          if 'axes' in kwargs and len(positions) < len(axes):
              raise ValueError('Length of "coordinates" or "deltas" cannot be less than that '
                               'of "axes".')
          elif 'axes' not in kwargs and len(positions) != len(axes):
              raise ValueError('Length of "coordinates" or "deltas" must match the number of '
                               'dimensions of "f" when "axes" is not given.')
  
      if 'deltas' in kwargs:
          if 'coordinates' in kwargs or 'x' in kwargs:
              raise ValueError('Cannot specify both "coordinates" and "deltas".')
          _check_length(kwargs['deltas'])
          return 'delta', kwargs['deltas'], axes
      elif 'coordinates' in kwargs:
          _check_length(kwargs['coordinates'])
          return 'x', kwargs['coordinates'], axes
      elif 'x' in kwargs:
          warnings.warn('The use of "x" as a parameter for coordinate values has been '
                        'deprecated. Use "coordinates" instead.', metpyDeprecation)
          _check_length(kwargs['x'])
          return 'x', kwargs['x'], axes
      elif isinstance(f, xr.DataArray):
          return 'pass', axes, axes  # only the axis argument matters
      else:
          raise ValueError('Must specify either "coordinates" or "deltas" for value positions '
                           'when "f" is not a DataArray.')
docs: Handle common processing of arguments for gradient and gradient-like functions.