def METHOD_NAME(
    course_id: CourseKey,
    user: Optional[User] = None,
    include_all: bool = False
) -> List[DiscussionXBlock]:
    """
    Return a list of all valid discussion xblocks in this course.
    Checks for the given user's access if include_all is False.
    """
    all_xblocks = modulestore().get_items(course_id, qualifiers={'category': 'discussion'}, include_orphans=False)
    return [
        xblock for xblock in all_xblocks
        if has_required_keys(xblock) and (include_all or has_access(user, 'load', xblock, course_id))
    ]