def badge_description(course, mode):
 if course.end:
  return _(u'Completed the course "{course_name}" ({course_mode}, {start_date} - {end_date})').format(start_date=course.start.date(), end_date=course.end.date(), course_name=course.display_name, course_mode=mode)
 else:
  return _(u'Completed the course "{course_name}" ({course_mode})').format(course_name=course.display_name, course_mode=mode)

def badge_description ( course , mode ) : if course . end : return _ ( u'Completed the course "{course_name}" ({course_mode}, {start_date} - {end_date})' ) . format ( start_date = course . start . date ( ) , end_date = course . end . date ( ) , course_name = course . display_name , course_mode = mode ) else : return _ ( u'Completed the course "{course_name}" ({course_mode})' ) . format ( course_name = course . display_name , course_mode = mode )
returns a description for the earned badge .