def course_info_as_string(course_info):
    """
    Given a dictionary as returned by `parse_course_code` with
    `with_section` true, return a course code string that can be used
    on the frontend.

    Throw ScrapeError if the course code is malformed.
    """
    assert course_info["section"]
    return "{} {:03d}{} {}-{:02d}".format(
        course_info["department"],
        course_info["courseNumber"],
        course_info["courseCodeSuffix"],
        course_info["school"],
        course_info["section"],
    )