code: def to_dict(self):
          
  
          rv = {
              'id': self.id,
              'type': self.type,
              'priority': self.priority
          }
          if self.recip_keys:
              rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in  self.recip_keys]
          if self.routing_keys:
              rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in self.routing_keys]
          rv['serviceEndpoint'] = self.endpoint
  
          return rv
docs: Return dict representation of service to embed in DID document.