def _get_thread_and_context(request, thread_id, retrieve_kwargs=None):
 retrieve_kwargs = (retrieve_kwargs or {})
 try:
  if ('with_responses' not in retrieve_kwargs):
   retrieve_kwargs['with_responses'] = False
  if ('mark_as_read' not in retrieve_kwargs):
   retrieve_kwargs['mark_as_read'] = False
  cc_thread = Thread(id=thread_id).retrieve(**retrieve_kwargs)
  course_key = CourseKey.from_string(cc_thread['course_id'])
  course = _get_course(course_key, request.user)
  context = get_context(course, request, cc_thread)
  if ((not context['is_requester_privileged']) and cc_thread['group_id'] and is_commentable_cohorted(course.id, cc_thread['commentable_id'])):
   requester_cohort = get_cohort_id(request.user, course.id)
   if ((requester_cohort is not None) and (cc_thread['group_id'] != requester_cohort)):
    raise ThreadNotFoundError('Thread not found.')
  return (cc_thread, context)
 except CommentClientRequestError:
  raise ThreadNotFoundError('Thread not found.')

def _get_thread_and_context ( request , thread_id , retrieve_kwargs = None ) : retrieve_kwargs = ( retrieve_kwargs or { } ) try : if ( 'with_responses' not in retrieve_kwargs ) : retrieve_kwargs [ 'with_responses' ] = False if ( 'mark_as_read' not in retrieve_kwargs ) : retrieve_kwargs [ 'mark_as_read' ] = False cc_thread = Thread ( id = thread_id ) . retrieve ( ** retrieve_kwargs ) course_key = CourseKey . from_string ( cc_thread [ 'course_id' ] ) course = _get_course ( course_key , request . user ) context = get_context ( course , request , cc_thread ) if ( ( not context [ 'is_requester_privileged' ] ) and cc_thread [ 'group_id' ] and is_commentable_cohorted ( course . id , cc_thread [ 'commentable_id' ] ) ) : requester_cohort = get_cohort_id ( request . user , course . id ) if ( ( requester_cohort is not None ) and ( cc_thread [ 'group_id' ] != requester_cohort ) ) : raise ThreadNotFoundError ( 'Thread not found.' ) return ( cc_thread , context ) except CommentClientRequestError : raise ThreadNotFoundError ( 'Thread not found.' )
retrieve the given thread and build a serializer context for it .