code: def websafe(val):
      r
      if val is None:
          return u''
      elif isinstance(val, str):
          val = val.decode('utf-8')
      elif not isinstance(val, unicode):
          val = unicode(val)
          
      return htmlquote(val)
docs: r"""Converts `val` so that it is safe for use in Unicode HTML.
  
          >>> websafe("<'&\">")
          u'&lt;&#39;&amp;&quot;&gt;'
          >>> websafe(None)
          u''
          >>> websafe(u'\u203d')
          u'\u203d'
          >>> websafe('\xe2\x80\xbd')
          u'\u203d'