def get_certificate_for_user(username, course_key):
 try:
  cert = GeneratedCertificate.eligible_certificates.get(user__username=username, course_id=course_key)
 except GeneratedCertificate.DoesNotExist:
  return None
 return format_certificate_for_user(username, cert)

def get_certificate_for_user ( username , course_key ) : try : cert = GeneratedCertificate . eligible_certificates . get ( user__username = username , course_id = course_key ) except GeneratedCertificate . DoesNotExist : return None return format_certificate_for_user ( username , cert )
retrieve certificate information for a particular user for a specific course .