import re


def format_raw_course(raw_course):
    """
    Given a raw course dictionary, return a string that can be output
    to the user in error messages.
    """
    # Try to put together a reasonable string representation of the
    # course for use in error messages, if it is malformed.
    desc = "{} {}".format(raw_course["course_code"], raw_course["course_name"])
    return re.sub(r"\s+", " ", desc).strip()