code: def pairwise_info2tags(pairwise: PairwiseInfo) -> dict:
      
  
      rv = {
          canon_pairwise_tag(tag): raw(pairwise.metadata[tag]) for tag in pairwise.metadata or {}
      }
      rv['~their_did'] = pairwise.their_did
      rv['~their_verkey'] = pairwise.their_verkey
      rv['~my_did'] = pairwise.my_did
      rv['~my_verkey'] = pairwise.my_verkey
  
      if not StorageRecord.ok_tags(rv):
          raise BadRecord('Pairwise metadata {} must map strings to strings'.format(rv))
  
      return rv
docs: Given pairwise info with metadata mapping tags to values, return corresponding
      indy-sdk non_secrets record tags dict to store same in wallet (via non_secrets)
      unencrypted (for WQL search options).  Canonicalize metadata values to strings via
      raw() for WQL fitness.
  
      Raise BadRecord if metadata does not coerce into non_secrets API tags spec of {str:str}.
  
      :param pairwise: pairwise info with metadata dict mapping tags to values
      :return: corresponding non_secrets tags dict marked for unencrypted storage