def _update_badge_context(context, course, user):
 badge = None
 if (badges_enabled() and course.issue_badges):
  badges = get_completion_badge(course.location.course_key, user).get_for_user(user)
  if badges:
   badge = badges[0]
 context['badge'] = badge

def _update_badge_context ( context , course , user ) : badge = None if ( badges_enabled ( ) and course . issue_badges ) : badges = get_completion_badge ( course . location . course_key , user ) . get_for_user ( user ) if badges : badge = badges [ 0 ] context [ 'badge' ] = badge
updates context with badge info .