def _latest_task_status(request, course_key_string, view_func=None): """ Get the most recent export status update for the specified course/library key. """ args = {u'course_key_string': course_key_string} name = CourseExportTask.generate_name(args) task_status = UserTaskStatus.objects.filter(name=name) for status_filter in STATUS_FILTERS: task_status = status_filter().filter_queryset(request, task_status, view_func) return task_status.order_by(u'-created').first()