code: def _transform_snapshot(raw_snapshot: str) -> str:
      
      snapshot = json.loads(raw_snapshot)
  
      for task in snapshot['payment_mapping']['secrethashes_to_task'].values():
          if 'raiden.transfer.state.InitiatorTask' in task['_type']:
              for initiator in task['manager_state']['initiator_transfers'].values():
                  msg = 'v20 initiator task should not contain allocated_fee'
                  assert 'allocated_fee' not in initiator['transfer_description'], msg
                  initiator['transfer_description']['allocated_fee'] = '0'
  
      msg = 'v20 snapshots should not contain tokennetworkaddresses_to_paymentnetworkaddresses'
      assert 'tokennetworkaddresses_to_paymentnetworkaddresses' not in snapshot, msg
      ids_to_addrs = dict()
      for payment_network in snapshot['identifiers_to_paymentnetworks'].values():
          for token_network in payment_network['tokennetworks']:
              ids_to_addrs[token_network['address']] = payment_network['address']
      snapshot['tokennetworkaddresses_to_paymentnetworkaddresses'] = ids_to_addrs
  
      for payment_network in snapshot['identifiers_to_paymentnetworks'].values():
          for token_network in payment_network['tokennetworks']:
              for channel_state in token_network['channelidentifiers_to_channels'].values():
                  msg = 'v20 channel state should not contain mediation_fee'
                  assert 'mediation_fee' not in channel_state, msg
                  channel_state['mediation_fee'] = '0'
  
      return json.dumps(snapshot)
docs: The transformation step does the following:
      1. Add `allocated_fee` to all initiator tasks
      2. Adds `mediation_fee` to all channels
      3. Populates tokennetworkaddresses_to_paymentnetworkaddresses in chain state