def make_spec_mine(self, msg) -> PBTariffSpecification: # let's clone this mine = Parse(MessageToJson(msg), PBTariffSpecification()) #set the broker mine.broker = cfg.ME #set new ID mine.id = id_generator.create_id() # also set the IDs of the rates for r in mine.rates: r.tariffId = mine.id for r in mine.regulationRates: r.tariffId = mine.id return mine