'Register an assertion with the Badgr server for a particular user for a specific class.'

def _create_assertion(self, badge_class, user, evidence_url):

    data = {'email': user.email, 'evidence': evidence_url}
    response = requests.post(self._assertion_url(self._slugify(badge_class)), headers=self._get_headers(), data=data, timeout=settings.BADGR_TIMEOUT)
    self._log_if_raised(response, data)
    (assertion, __) = BadgeAssertion.objects.get_or_create(user=user, badge_class=badge_class)
    assertion.data = response.json()
    assertion.backend = 'BadgrBackend'
    assertion.image_url = assertion.data['image']
    assertion.assertion_url = assertion.data['json']['id']
    assertion.save()
    self._send_assertion_created_event(user, assertion)
    return assertion
