import json


def json_dumps(dictionary, pretty=True):
    """Dump dictionary to JSON, do it pretty by default.

    :param dictionary: dictionary to serialize
    :param pretty: do pretty formatting
    :return: serialized dictionary to JSON string
    """
    pretty_json_kwargs = {}
    if pretty:
        pretty_json_kwargs = {
            'sort_keys': True,
            'separators': (',', ': '),
            'indent': 2
        }

    return json.dumps(dictionary, **pretty_json_kwargs)