parameters: (s)
return_statement: return ",".join(map(_unicode, utf16)), ",".join(map(_unicode, utf32))
docstring: Create Py_UNICODE[] representation of a given unicode string.
docstring_summary: Create Py_UNICODE[] representation of a given unicode string.
docstring_tokens: Create Py_UNICODE [] representation of a given unicode string .
function: def encode_pyunicode_string(s):
      """Create Py_UNICODE[] representation of a given unicode string.
      """
      s = list(map(ord, s)) + [0]
  
      if sys.maxunicode >= 0x10000:  # Wide build or Py3.3
          utf16, utf32 = [], s
          for code_point in s:
              if code_point >= 0x10000:  # outside of BMP
                  high, low = divmod(code_point - 0x10000, 1024)
                  utf16.append(high + 0xD800)
                  utf16.append(low + 0xDC00)
              else:
                  utf16.append(code_point)
      else:
          utf16, utf32 = s, []
          for code_unit in s:
              if 0xDC00 <= code_unit <= 0xDFFF and utf32 and 0xD800 <= utf32[-1] <= 0xDBFF:
                  high, low = utf32[-1], code_unit
                  utf32[-1] = ((high & 0x3FF) << 10) + (low & 0x3FF) + 0x10000
              else:
                  utf32.append(code_unit)
  
      if utf16 == utf32:
          utf16 = []
      return ",".join(map(_unicode, utf16)), ",".join(map(_unicode, utf32))
function_tokens: def encode_pyunicode_string ( s ) : s = list ( map ( ord , s ) ) + [ 0 ] if sys . maxunicode >= 0x10000 : # Wide build or Py3.3 utf16 , utf32 = [ ] , s for code_point in s : if code_point >= 0x10000 : # outside of BMP high , low = divmod ( code_point - 0x10000 , 1024 ) utf16 . append ( high + 0xD800 ) utf16 . append ( low + 0xDC00 ) else : utf16 . append ( code_point ) else : utf16 , utf32 = s , [ ] for code_unit in s : if 0xDC00 <= code_unit <= 0xDFFF and utf32 and 0xD800 <= utf32 [ - 1 ] <= 0xDBFF : high , low = utf32 [ - 1 ] , code_unit utf32 [ - 1 ] = ( ( high & 0x3FF ) << 10 ) + ( low & 0x3FF ) + 0x10000 else : utf32 . append ( code_unit ) if utf16 == utf32 : utf16 = [ ] return "," . join ( map ( _unicode , utf16 ) ) , "," . join ( map ( _unicode , utf32 ) )