code: def _calc_norm_coeff(h, J, bias_range, quadratic_range, ignored_variables,
                       ignored_interactions):
      
  
      if ignored_variables is None or ignored_interactions is None:
          raise ValueError('ignored interactions or variables cannot be None')
  
      def parse_range(r):
          if isinstance(r, Number):
              return -abs(r), abs(r)
          return r
  
      def min_and_max(iterable):
          if not iterable:
              return 0, 0
          return min(iterable), max(iterable)
  
      if quadratic_range is None:
          linear_range, quadratic_range = bias_range, bias_range
      else:
          linear_range = bias_range
  
      lin_range, quad_range = map(parse_range, (linear_range,
                                                quadratic_range))
  
      lin_min, lin_max = min_and_max([v for k, v in h.items()
                                      if k not in ignored_variables])
      quad_min, quad_max = min_and_max([v for k, v in J.items()
                                        if not check_isin(k,
                                                          ignored_interactions)])
  
      inv_scalar = max(lin_min / lin_range[0], lin_max / lin_range[1],
                       quad_min / quad_range[0], quad_max / quad_range[1])
  
      if inv_scalar != 0:
          return 1. / inv_scalar
      else:
          return 1.
docs: Helper function to calculate normalization coefficient