'Create the badge class on Badgr.'

def _create_badge(self, badge_class):

    image = badge_class.image
    (content_type, __) = mimetypes.guess_type(image.name)
    if (not content_type):
        raise ValueError(u'Could    not    determine    content-type    of    image!    Make    sure    it    is    a    properly    named    .png    file.    Filename    was:    {}'.format(image.name))
    files = {'image': (image.name, image, content_type)}
    data = {'name': badge_class.display_name, 'criteria': badge_class.criteria, 'slug': self._slugify(badge_class), 'description': badge_class.description}
    result = requests.post(self._badge_create_url, headers=self._get_headers(), data=data, files=files, timeout=settings.BADGR_TIMEOUT)
    self._log_if_raised(result, data)
