code: def badgify_badges(**kwargs):
      
      User = get_user_model()
      user = kwargs.get('user', None)
      username = kwargs.get('username', None)
      if username:
          try:
              user = User.objects.get(username=username)
          except User.DoesNotExist:
              pass
      if user:
          awards = Award.objects.filter(user=user).select_related('badge')
          badges = [award.badge for award in awards]
          return badges
      return Badge.objects.all()
docs: Returns all badges or only awarded badges for the given user.