parameters: (conn)
return_statement: return res
docstring: reads length of text to read, and then the text encoded in UTF-8, and returns the string
docstring_summary: reads length of text to read, and then the text encoded in UTF-8, and returns the string
docstring_tokens: reads length of text to read and then the text encoded in UTF - 8 and returns the string
function: def read_string(conn):
      """ reads length of text to read, and then the text encoded in UTF-8, and returns the string"""
      strlen = read_int(conn)
      if not strlen:
          return ''
      res = to_bytes('')
      while len(res) < strlen:
          res = res + conn.recv(strlen - len(res))
  
      res = utf_8.decode(res)[0]
      if sys.version_info[0] == 2 and sys.platform != 'cli':
          # Py 2.x, we want an ASCII string if possible
          try:
              res = ascii.Codec.encode(res)[0]
          except UnicodeEncodeError:
              pass
  
      return res
function_tokens: def read_string ( conn ) : strlen = read_int ( conn ) if not strlen : return '' res = to_bytes ( '' ) while len ( res ) < strlen : res = res + conn . recv ( strlen - len ( res ) ) res = utf_8 . decode ( res ) [ 0 ] if sys . version_info [ 0 ] == 2 and sys . platform != 'cli' : # Py 2.x, we want an ASCII string if possible try : res = ascii . Codec . encode ( res ) [ 0 ] except UnicodeEncodeError : pass return res