def course_reverse_func_from_name_func(reverse_name_func):
    """
    Returns a function that will determine a course URL for the provided
    reverse_name_func.

    Use this when the calculation of the reverse_name is dependent on the
    course. Otherwise, use the simpler course_reverse_func.

    This can be used to generate the url for a CourseTab without having
    immediate access to Django's reverse function.

    Arguments:
        reverse_name_func (function): A function that takes a single argument
            (Course) and returns the name to be used with the reverse function.

    Returns:
        A function that takes in two arguments:
            course (Course): the course in question.
            reverse_url_func (function): a reverse function for a course URL
                that uses the course ID in the url.
        When called, the returned function will return the course URL as
        determined by calling reverse_url_func with the reverse_name and the
        course's ID.
    """
    return lambda course, reverse_url_func: reverse_url_func(
        reverse_name_func(course),
        args=[str(course.id)]
    )