Return prettified JSON `data`, set ``response.content_type`` to
    ``application/json; charset=utf-8``.

    Args:
        data (any): Any basic python data structure.

    Returns:
        str: Data converted to prettified JSON.

def encode_json_body(data):
    """
    Return prettified JSON `data`, set ``response.content_type`` to
    ``application/json; charset=utf-8``.

    Args:
        data (any): Any basic python data structure.

    Returns:
        str: Data converted to prettified JSON.
    """
    # support for StringIO / file - like objects
    if hasattr(data, "read"):
        return data

    response.content_type = "application/json; charset=utf-8"

    return json.dumps(
        data,
        indent=4,
        separators=(',', ': ')
    )