def validate_request_data_and_get_certificate(certificate_invalidation, course_key):
 user = certificate_invalidation.get('user')
 if (not user):
  raise ValueError(_('Student username/email field is required and can not be empty. Kindly fill in username/email and then press "Invalidate Certificate" button.'))
 student = get_student(user, course_key)
 certificate = GeneratedCertificate.certificate_for_student(student, course_key)
 if (not certificate):
  raise ValueError(_('The student {student} does not have certificate for the course {course}. Kindly verify student username/email and the selected course are correct and try again.').format(student=student.username, course=course_key.course))
 return certificate

def validate_request_data_and_get_certificate ( certificate_invalidation , course_key ) : user = certificate_invalidation . get ( 'user' ) if ( not user ) : raise ValueError ( _ ( 'Student username/email field is required and can not be empty. Kindly fill in username/email and then press "Invalidate Certificate" button.' ) ) student = get_student ( user , course_key ) certificate = GeneratedCertificate . certificate_for_student ( student , course_key ) if ( not certificate ) : raise ValueError ( _ ( 'The student {student} does not have certificate for the course {course}. Kindly verify student username/email and the selected course are correct and try again.' ) . format ( student = student . username , course = course_key . course ) ) return certificate
fetch and return generatedcertificate of the student passed in request data for the given course .