from typing import Union
import json


def prettify(data: Union[list, dict]) -> str:
    """
    Return input data structure (list or dict) as a prettified JSON-formatted string.

    Default is set here to stringify values like datetime values.
    """
    return json.dumps(data, indent=4, sort_keys=True, default=str)