<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_slug(self):
 """ Generate a valid slug, in case the given one is taken """

        source = self.cleaned_data.get('slug', '')
        lang_choice = self.language_code
        if not source:
            source = slugify(self.cleaned_data.get('title', ''))
        qs = Post._default_manager.active_translations(lang_choice).language(lang_choice)
        used = list(qs.values_list('translations__slug', flat=True))
        slug = source
        i = 1
        while slug in used:
            slug = '%s-%s' % (source, i)
            i += 1
        return slug