def get_annotated_content_infos(course_id, thread, user, user_info):
 infos = {}
 def annotate(content):
  infos[str(content['id'])] = get_annotated_content_info(course_id, content, user, user_info)
  for child in ((content.get('children', []) + content.get('endorsed_responses', [])) + content.get('non_endorsed_responses', [])):
   annotate(child)
 annotate(thread)
 return infos

def get_annotated_content_infos ( course_id , thread , user , user_info ) : infos = { } def annotate ( content ) : infos [ str ( content [ 'id' ] ) ] = get_annotated_content_info ( course_id , content , user , user_info ) for child in ( ( content . get ( 'children' , [ ] ) + content . get ( 'endorsed_responses' , [ ] ) ) + content . get ( 'non_endorsed_responses' , [ ] ) ) : annotate ( child ) annotate ( thread ) return infos
get metadata for a thread and its children .