def course_slug(course_key, mode):
 digest = hashlib.sha256(u'{}{}'.format(unicode(course_key), unicode(mode))).hexdigest()[:7]
 base_slug = slugify((unicode(course_key) + u'_{}_'.format(mode)))[:248]
 return (base_slug + digest)

def course_slug ( course_key , mode ) : digest = hashlib . sha256 ( u'{}{}' . format ( unicode ( course_key ) , unicode ( mode ) ) ) . hexdigest ( ) [ : 7 ] base_slug = slugify ( ( unicode ( course_key ) + u'_{}_' . format ( mode ) ) ) [ : 248 ] return ( base_slug + digest )
legacy: not to be used as a model for constructing badge slugs .