'Create a badge class, using a course id if it\'s relevant to the URL pattern.'

def create_badge_class(self, check_course, **kwargs):

    if check_course:
        return RandomBadgeClassFactory.create(course_id=self.course.location.course_key, **kwargs)
    return RandomBadgeClassFactory.create(**kwargs)
