def Parse(text, message):
if not isinstance(text, six.text_type): text = text.decode('<STR_LIT:utf-8>')<EOL>try:<EOL><INDENT>if sys.version_info < (<NUM_LIT:2>, <NUM_LIT:7>):<EOL><INDENT>js = json.loads(text)<EOL><DEDENT>else:<EOL><INDENT>js = json.loads(text, object_pairs_hook=_DuplicateChecker)<EOL><DEDENT><DEDENT>except ValueError as e:<EOL><INDENT>raise ParseError('<STR_LIT>'.format(str(e)))<EOL><DEDENT>_ConvertMessage(js, message)<EOL>return message<EOL>
Parses a JSON representation of a protocol message into a message.

    Args:
      text: Message JSON representation.
      message: A protocol beffer message to merge into.

    Returns:
      The same message passed as argument.

    Raises::
      ParseError: On JSON parsing problems.