import re


def syllabus_name(course):
    """Creates the syllabus name that DSpace expects."""
    lastname = re.sub('[^0-9a-zA-Z]+', '_', course.lastname)
    firstname = re.sub('[^0-9a-zA-Z]+', '_', course.firstname)
    return '{0}_{1}_{2}_{3}_{4}_{5}_syllabus'.format(
        course.yr,
        course.sess,
        course.crs_no.replace(' ', '_'),
        course.sec_no,
        lastname,
        firstname,
    )