code: def whichEncoding(self):
          
          if self.hasReturnTo():
              if self.openid_message.isOpenID1() and \
                 len(self.encodeToURL()) > OPENID1_URL_LIMIT:
                  return ENCODE_HTML_FORM
              else:
                  return ENCODE_URL
  
          if self.openid_message is None:
              return None
  
          mode = self.openid_message.getArg(OPENID_NS, 'mode')
          if mode:
              if mode not in BROWSER_REQUEST_MODES:
                  return ENCODE_KVFORM
  
          # According to the OpenID spec as of this writing, we are probably
          # supposed to switch on request type here (GET versus POST) to figure
          # out if we're supposed to print machine-readable or human-readable
          # content at this point.  GET/POST seems like a pretty lousy way of
          # making the distinction though, as it's just as possible that the
          # user agent could have mistakenly been directed to post to the
          # server URL.
  
          # Basically, if your request was so broken that you didn't manage to
          # include an openid.mode, I'm not going to worry too much about
          # returning you something you can't parse.
          return None
docs: How should I be encoded?
  
          @returns: one of ENCODE_URL, ENCODE_KVFORM, or None.  If None,
              I cannot be encoded as a protocol message and should be
              displayed to the user.