def complete_course_mode_info(course_id, enrollment, modes=None):
 if (modes is None):
  modes = CourseMode.modes_for_course_dict(course_id)
 mode_info = {'show_upsell': False, 'days_for_upsell': None}
 if ((CourseMode.VERIFIED in modes) and (enrollment.mode in CourseMode.UPSELL_TO_VERIFIED_MODES)):
  mode_info['show_upsell'] = True
  mode_info['verified_sku'] = modes['verified'].sku
  mode_info['verified_bulk_sku'] = modes['verified'].bulk_sku
  if modes['verified'].expiration_datetime:
   today = datetime.datetime.now(UTC).date()
   mode_info['days_for_upsell'] = (modes['verified'].expiration_datetime.date() - today).days
 return mode_info

def complete_course_mode_info ( course_id , enrollment , modes = None ) : if ( modes is None ) : modes = CourseMode . modes_for_course_dict ( course_id ) mode_info = { 'show_upsell' : False , 'days_for_upsell' : None } if ( ( CourseMode . VERIFIED in modes ) and ( enrollment . mode in CourseMode . UPSELL_TO_VERIFIED_MODES ) ) : mode_info [ 'show_upsell' ] = True mode_info [ 'verified_sku' ] = modes [ 'verified' ] . sku mode_info [ 'verified_bulk_sku' ] = modes [ 'verified' ] . bulk_sku if modes [ 'verified' ] . expiration_datetime : today = datetime . datetime . now ( UTC ) . date ( ) mode_info [ 'days_for_upsell' ] = ( modes [ 'verified' ] . expiration_datetime . date ( ) - today ) . days return mode_info
we would like to compute some more information from the given course modes and the users current enrollment returns the given information: - whether to show the course upsell information - numbers of days until they cant upsell anymore .