import yaml
import json


def pretty(data, style=None, sort_keys=None, indent=None):
    """
    pretty-print some data using some defaults which can be overridden.
    The default style is json.

    Parameters:
        data: the data to print
        style (str) one of 'json', 'yaml', or None to accept the default
        sort_keys (bool): print dicts in sorted order
        indent (str): the indentation to use

    Returns:
        str: the formatted string.
    """
    if indent is None:
        indent = 4
    if style is None:
        style = 'json'
    if sort_keys is None:
        sort_keys = True
    if style == 'yaml':
        return yaml.dump(data, sort_keys=sort_keys, default_flow_style=False, indent=indent, default_style=None, line_break="\n")
    else:
        return json.dumps(data, sort_keys=sort_keys, separators=(", ", " : "), indent=indent)