'Get all assertions for a user, optionally constrained to a course.'

@classmethod
def assertions_for_user(cls, user, course_id=None):

    if course_id:
        return cls.objects.filter(user=user, badge_class__course_id=course_id)
    return cls.objects.filter(user=user)
