code: def _update_weights(self, margins, parameters = {}):
          
          data = self._build_calmar_data()
          assert self.initial_weight_name is not None
          parameters['initial_weight'] = self.initial_weight_name
          val_pondfin, lambdasol, updated_margins = calmar(
              data, margins, **parameters)
          # Updating only afetr filtering weights
          self.weight = val_pondfin * self.filter_by + self.weight * (logical_not(self.filter_by))
          return updated_margins
docs: Run calmar, stores new weights and returns adjusted margins