def may_certify_for_course(certificates_display_behavior, certificates_show_before_end, has_ended):
 show_early = ((certificates_display_behavior in ('early_with_info', 'early_no_info')) or certificates_show_before_end)
 return (show_early or has_ended)

def may_certify_for_course ( certificates_display_behavior , certificates_show_before_end , has_ended ) : show_early = ( ( certificates_display_behavior in ( 'early_with_info' , 'early_no_info' ) ) or certificates_show_before_end ) return ( show_early or has_ended )
returns whether it is acceptable to show the student a certificate download link for a course .