Find the category for a given slug

def get_category_for_slug(slug, language_code=None):
    """
    Find the category for a given slug
    """
    Category = get_category_model()
    if issubclass(Category, TranslatableModel):
        return Category.objects.active_translations(language_code, slug=slug).get()
    else:
        return Category.objects.get(slug=slug)