def METHOD_NAME(program_uuid, course_key, paginate_queryset_fn=None):
    """
    Load grades (or grading errors) for a given program-course.
    Arguments:
        program_uuid (str)
        course_key (CourseKey)
        paginate_queryset_fn (QuerySet -> QuerySet):
            Optional function to paginate the results,
            generally passed in from `self.request.paginate_queryset`
            on a paginated DRF `APIView`.
            If `None`, all results will be loaded and returned.
    Returns: generator[BaseProgramCourseGrade]
    """
    enrollments_qs = fetch_program_course_enrollments(
        program_uuid=program_uuid,
        course_key=course_key,
        realized_only=True,
    ).select_related(
        'program_enrollment',
        'program_enrollment__user',
    ).using(read_replica_or_default())
    enrollments = (
        paginate_queryset_fn(enrollments_qs) if paginate_queryset_fn
        else enrollments_qs
    )
    if not enrollments:
        return []
    return _generate_grades(course_key, list(enrollments))