code: def can_manage_groups(cls, user):
          
          if user.is_authenticated:
              return cls.has_management_permission(user) or user.leads_groups.all()
          return False
docs: For use with user_passes_test decorator.
          Check if the user can manage groups. Either has the
          auth.group_management permission or is a leader of at least one group
          and is also a Member.
          :param user: django.contrib.auth.models.User for the request
          :return: bool True if user can manage groups, False otherwise