code: def get_key_by_kid(self, kid, algorithm, service_context):
          
          _key = service_context.keyjar.get_key_by_kid(kid)
          if _key:
              ktype = alg2keytype(algorithm)
              if _key.kty != ktype:
                  raise NoMatchingKey("Wrong key type")
              else:
                  return _key
          else:
              raise NoMatchingKey("No key with kid:%s" % kid)
docs: Pick a key that matches a given key ID and signing algorithm.
  
          :param kid: Key ID
          :param algorithm: Signing algorithm
          :param service_context: A
              :py:class:`oidcservice.service_context.ServiceContext` instance
          :return: A matching key