code: def _set_weights(self, weights):
          
  
          if isinstance(weights, type(None)):
              weights = np.repeat(1.0 / self._prox_list.size,
                                  self._prox_list.size)
          elif not isinstance(weights, (list, tuple, np.ndarray)):
              raise TypeError('Weights must be provided as a list.')
  
          weights = np.array(weights)
  
          if not np.issubdtype(weights.dtype, np.floating):
              raise ValueError('Weights must be list of float values.')
  
          if weights.size != self._prox_list.size:
              raise ValueError('The number of weights must match the number of '
                               'proximity operators.')
  
          if np.sum(weights) != 1.0:
              raise ValueError('Proximity operator weights must sum to 1.0.'
                               'Current sum of weights = ' +
                               str(np.sum(weights)))
  
          self._weights = weights
docs: Set Weights
  
          This method sets weights on each of the proximty operators provided
  
          Parameters
          ----------
          weights : list, tuple or np.ndarray
              List of weights
  
          Raises
          ------
          TypeError
              For invalid input type
          ValueError
              If weights do not sum to one