code: def _exposure_to_weights(self, y, exposure=None, weights=None):
          
          y = y.ravel()
  
          if exposure is not None:
              exposure = np.array(exposure).astype('f').ravel()
              exposure = check_array(exposure, name='sample exposure',
                                     ndim=1, verbose=self.verbose)
          else:
              exposure = np.ones_like(y.ravel()).astype('float64')
  
          # check data
          exposure = exposure.ravel()
          check_lengths(y, exposure)
  
          # normalize response
          y = y / exposure
  
          if weights is not None:
              weights = np.array(weights).astype('f').ravel()
              weights = check_array(weights, name='sample weights',
                                    ndim=1, verbose=self.verbose)
          else:
              weights = np.ones_like(y).astype('float64')
          check_lengths(weights, exposure)
  
          # set exposure as the weight
          # we do this because we have divided our response
          # so if we make an error of 1 now, we need it to count more heavily.
          weights = weights * exposure
  
          return y, weights
docs: simple tool to create a common API
  
          Parameters
          ----------
          y : array-like, shape (n_samples,)
              Target values (integers in classification, real numbers in
              regression)
              For classification, labels must correspond to classes.
          exposure : array-like shape (n_samples,) or None, default: None
              containing exposures
              if None, defaults to array of ones
          weights : array-like shape (n_samples,) or None, default: None
              containing sample weights
              if None, defaults to array of ones
  
          Returns
          -------
          y : y normalized by exposure
          weights : array-like shape (n_samples,)