import json


def format_str(str_value, is_json):
    """
    Returns a formatted string with break lines; if is_json True, pretty format the output
    :param str_value: plain text or json value
    :param is_json: Boolean
    :return: str
    """
    str_value = json.dumps(str_value, indent=4, sort_keys=True) if is_json else str_value
    return '\n {} \n'.format(str_value)