def get_required_content(course_key, user):
    """
    Queries milestones subsystem to see if the specified course is gated on one or more milestones,
    and if those milestones can be fulfilled via completion of a particular course content module
    """
    required_content = []
    if ENABLE_MILESTONES_APP.is_enabled():
        course_run_id = str(course_key)

        if user.is_authenticated:
            # Get all of the outstanding milestones for this course, for this user
            try:

                milestone_paths = get_course_milestones_fulfillment_paths(
                    course_run_id,
                    serialize_user(user)
                )
            except InvalidMilestoneRelationshipTypeException:
                return required_content

            # For each outstanding milestone, see if this content is one of its fulfillment paths
            for path_key in milestone_paths:
                milestone_path = milestone_paths[path_key]
                if milestone_path.get('content') and len(milestone_path['content']):  # lint-amnesty, pylint: disable=len-as-condition
                    for content in milestone_path['content']:
                        required_content.append(content)
        else:
            if get_course_milestones(course_run_id):
                # NOTE (CCB): The initial version of anonymous courseware access is very simple. We avoid accidentally
                # exposing locked content by simply avoiding anonymous access altogether for courses runs with
                # milestones.
                raise InvalidUserException('Anonymous access is not allowed for course runs with milestones set.')

    return required_content