def METHOD_NAME(course, parent_folder_uuid, key):
    session_mgr = PanoptoSessionManager(
        settings.PANOPTO_SERVER, settings.PANOPTO_API_USER,
        instance_name=settings.PANOPTO_INSTANCE_NAME,
        password=settings.PANOPTO_API_PASSWORD)
    parent_folder = parent_folder_uuid
    try:
        term_year = course.info.termyear()
        if term_year:
            folder_id = session_mgr.get_folder(parent_folder_uuid, term_year)
            if folder_id:
                parent_folder = folder_id
    except CourseInfo.DoesNotExist:
        pass
    new_folder = session_mgr.get_folder(parent_folder, course.title)
    if len(new_folder) < 1:
        new_folder = session_mgr.add_folder(course.title, parent_folder)
    if len(new_folder) > 0:
        course.add_detail(key, new_folder)
    return new_folder