docs: def encode(self, response):
          """Encode a response to a L{WebResponse}, signing it first if appropriate.
  
          @raises EncodingError: When I can't figure out how to encode this
              message.
  
          @raises AlreadySigned: When this response is already signed.
  
          @returntype: L{WebResponse}
          """
          # the isinstance is a bit of a kludge... it means there isn't really
          # an adapter to make the interfaces quite match.
          if (not isinstance(response, Exception)) and response.needsSigning():
              if not self.signatory:
                  raise ValueError(
                      "Must have a store to sign this request: %s" %
                      (response,), response)
              if response.fields.hasKey(OPENID_NS, 'sig'):
                  raise AlreadySigned(response)
              response = self.signatory.sign(response)
          return super(SigningEncoder, self).encode(response)