import pprint


def _format_errors(errors, params):
    """ Make human-readable error messages from a cerberus validation instance """
    err_str = ""
    # Create a bulleted list of each cerberus error message
    for key in errors:
        for err_msg in errors[key]:
            err_str += " * " + key + ": " + err_msg + "\n"
    return "".join([
        "KBaseReport parameter validation errors:\n",
        err_str,
        "You parameters were:\n",
        pprint.pformat(params)
        # "\n(View the type spec here: ",
        # Can point to a KIDL type spec for user reference:
        # "https://github.com/jayrbolton/KBaseReportPy/blob/master/KBaseReportPy.spec)\n",
    ])