def folder_exists(course, folder_name):
    """
    Tests whether a folder exists for a course
    The folder name is everything following the 'files/folder/' in the folder's URL:

    'folder_name' in the case of this URL
    https://canvas.instance.com/courses/course_id/files/folder/folder_name

    OR

    'folder1/folder2/folder_name' in the case of this URL
    https://canvas.instance.com/courses/course_id/files/folder/folder1/folder2/folder_name
    """
    for folder in course.get_folders():
        if folder.full_name == 'course files/' + folder_name:
            return True
    return False