generate m2m field related to class wait popup crud

def get_m2m_popup_field(cls, *args, **kwargs):
        """
        generate m2m field related to class wait popup crud
        """
        kwargs['popup_name'] = cls.get_class_verbose_name()
        kwargs['permissions_required'] = cls.permissions_required
        if cls.template_name_m2m is not None:
            kwargs['template_name'] = cls.template_name_m2m
        return ManyToManyWidget('{}_popup_create'.format(cls.get_class_name()), *args, **kwargs)