'Gets a certificate information.
Args:
request (Request): Django request object.
username (string): URI element specifying the user\'s username.
course_id (string): URI element specifying the course location.
Return:
A JSON serialized representation of the certificate.'

def get(self, request, username, course_id):

    try:
        course_key = CourseKey.from_string(course_id)
    except InvalidKeyError:
        log.warning('Course    ID    string    "%s"    is    not    valid', course_id)
        return Response(status=404, data={'error_code': 'course_id_not_valid'})
    user_cert = get_certificate_for_user(username=username, course_key=course_key)
    if (user_cert is None):
        return Response(status=404, data={'error_code': 'no_certificate_for_user'})
    return Response({'username': user_cert.get('username'), 'course_id': unicode(user_cert.get('course_key')), 'certificate_type': user_cert.get('type'), 'created_date': user_cert.get('created'), 'status': user_cert.get('status'), 'is_passing': user_cert.get('is_passing'), 'download_url': user_cert.get('download_url'), 'grade': user_cert.get('grade')})
