'Return certificate invalidations filtered based on the provided course and student (if provided),
Returned value is JSON serializable list of dicts, dict element would have the following key-value pairs.
1. id: certificate invalidation id (primary key)
2. user: username of the student to whom certificate belongs
3. invalidated_by: user id of the instructor/support user who invalidated the certificate
4. created: string containing date of invalidation in the following format "December 29, 2015"
5. notes: string containing notes regarding certificate invalidation.'

@classmethod
def get_certificate_invalidations(cls, course_key, student=None):

    certificate_invalidations = cls.objects.filter(generated_certificate__course_id=course_key, active=True)
    if student:
        certificate_invalidations = certificate_invalidations.filter(generated_certificate__user=student)
    data = []
    for certificate_invalidation in certificate_invalidations:
        data.append({'id': certificate_invalidation.id, 'user': certificate_invalidation.generated_certificate.user.username, 'invalidated_by': certificate_invalidation.invalidated_by.username, 'created': certificate_invalidation.created.strftime('%B    %d,    %Y'), 'notes': certificate_invalidation.notes})
    return data
