def _handle_zeros_in_scale(scale, copy=True):
 if np.isscalar(scale):
  if (scale == 0.0):
   scale = 1.0
  return scale
 elif isinstance(scale, np.ndarray):
  if copy:
   scale = scale.copy()
  scale[(scale == 0.0)] = 1.0
  return scale

def _handle_zeros_in_scale ( scale , copy = True ) : if np . isscalar ( scale ) : if ( scale == 0.0 ) : scale = 1.0 return scale elif isinstance ( scale , np . ndarray ) : if copy : scale = scale . copy ( ) scale [ ( scale == 0.0 ) ] = 1.0 return scale
makes sure that whenever scale is zero .