code: def sanitize_jid(s):
      
      jid = unicode_to_ascii(s).lower()
      jid = WHITESPACE.sub('-', jid)
      jid = INVALID_JID_CHARS.sub('', jid)
      return jid.strip()[:256]
docs: Generates a valid JID node identifier from a string