nodes: 0, module; 1, function_definition; 2, function_name:Dump; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# Python 2 json.dumps expects separators as a tuple of bytes, while; 10, comment:# Python 3 expects them to be a tuple of unicode strings. Pytype; 11, comment:# is too dumb to infer the result of the if statement that sets; 12, comment:# _SEPARATORS and complains when running in Python 3 mode.; 13, expression_statement; 14, comment:# pytype: disable=wrong-arg-types; 15, comment:# `text` is an instance of `bytes` if the object to serialize does not contain; 16, comment:# any unicode characters, otherwise it is `unicode`. See [1] for details.; 17, comment:#; 18, comment:# [1]: https://bugs.python.org/issue13769; 19, if_statement; 20, return_statement; 21, identifier:sort_keys; 22, False; 23, identifier:encoder; 24, None; 25, comment:"""Stringifies a Python object into its JSON representation.
  
    Args:
      obj: A Python object to convert to JSON.
      sort_keys: If True, output dictionaries keys in sorted (ascending) order.
      encoder: An (optional) encoder class to use.
  
    Returns:
      A JSON representation of the given object.
    """; 26, assignment; 27, boolean_operator; 28, block; 29, identifier:text; 30, identifier:text; 31, call; 32, attribute; 33, call; 34, expression_statement; 35, comment:# pytype: disable=attribute-error; 36, attribute; 37, argument_list; 38, identifier:compatibility; 39, identifier:PY2; 40, identifier:isinstance; 41, argument_list; 42, assignment; 43, identifier:json; 44, identifier:dumps; 45, identifier:obj; 46, keyword_argument; 47, keyword_argument; 48, keyword_argument; 49, keyword_argument; 50, keyword_argument; 51, identifier:text; 52, identifier:bytes; 53, identifier:text; 54, call; 55, identifier:indent; 56, integer:2; 57, identifier:sort_keys; 58, identifier:sort_keys; 59, identifier:ensure_ascii; 60, False; 61, identifier:cls; 62, identifier:encoder; 63, identifier:separators; 64, identifier:_SEPARATORS; 65, attribute; 66, argument_list; 67, identifier:text; 68, identifier:decode; 69, string:"utf-8"
code: def Dump(obj,
           sort_keys = False,
           encoder = None):
    """Stringifies a Python object into its JSON representation.
  
    Args:
      obj: A Python object to convert to JSON.
      sort_keys: If True, output dictionaries keys in sorted (ascending) order.
      encoder: An (optional) encoder class to use.
  
    Returns:
      A JSON representation of the given object.
    """
    # Python 2 json.dumps expects separators as a tuple of bytes, while
    # Python 3 expects them to be a tuple of unicode strings. Pytype
    # is too dumb to infer the result of the if statement that sets
    # _SEPARATORS and complains when running in Python 3 mode.
    text = json.dumps(
        obj,
        indent=2,
        sort_keys=sort_keys,
        ensure_ascii=False,
        cls=encoder,
        separators=_SEPARATORS)  # pytype: disable=wrong-arg-types
  
    # `text` is an instance of `bytes` if the object to serialize does not contain
    # any unicode characters, otherwise it is `unicode`. See [1] for details.
    #
    # [1]: https://bugs.python.org/issue13769
    if compatibility.PY2 and isinstance(text, bytes):
      text = text.decode("utf-8")  # pytype: disable=attribute-error
  
    return text