code: def add(self, spec, method, level=0, authn_authority="", reference=None):
          
  
          if spec.authn_context_class_ref:
              key = spec.authn_context_class_ref.text
              _info = {
                  "class_ref": key,
                  "method": method,
                  "level": level,
                  "authn_auth": authn_authority
              }
          elif spec.authn_context_decl:
              key = spec.authn_context_decl.c_namespace
              _info = {
                  "method": method,
                  "decl": spec.authn_context_decl,
                  "level": level,
                  "authn_auth": authn_authority
              }
          else:
              raise NotImplementedError()
  
          self.next += 1
          _ref = reference
          if _ref is None:
              _ref = str(self.next)
  
          assert _ref not in self.db["info"]
          self.db["info"][_ref] = _info
          try:
              self.db["key"][key].append(_ref)
          except KeyError:
              self.db["key"][key] = [_ref]
docs: Adds a new authentication method.
          Assumes not more than one authentication method per AuthnContext
          specification.
  
          :param spec: What the authentication endpoint offers in the form
              of an AuthnContext
          :param method: A identifier of the authentication method.
          :param level: security level, positive integers, 0 is lowest
          :param reference: Desired unique reference to this `spec'
          :return: