'Get a compatible badge slug from the specification.'

def _slugify(self, badge_class):

    slug = (badge_class.issuing_component + badge_class.slug)
    if (badge_class.issuing_component and badge_class.course_id):
        slug = hashlib.sha256((slug + unicode(badge_class.course_id))).hexdigest()
    if (len(slug) > MAX_SLUG_LENGTH):
        slug = hashlib.sha256(slug).hexdigest()
    return slug
