<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_form_success_data(self, form):
 """ Allows customization of the JSON data returned when a valid form submission occurs. """

        data = {
            "html": render_to_string(
                "pinax/teams/_invite_form.html",
                {
                    "invite_form": self.get_unbound_form(),
                    "team": self.team
                },
                request=self.request
            )
        }

        membership = self.membership
        if membership is not None:
            if membership.state == Membership.STATE_APPLIED:
                fragment_class = ".applicants"
            elif membership.state == Membership.STATE_INVITED:
                fragment_class = ".invitees"
            elif membership.state in (Membership.STATE_AUTO_JOINED, Membership.STATE_ACCEPTED):
                fragment_class = {
                    Membership.ROLE_OWNER: ".owners",
                    Membership.ROLE_MANAGER: ".managers",
                    Membership.ROLE_MEMBER: ".members"
                }[membership.role]
            data.update({
                "append-fragments": {
                    fragment_class: render_to_string(
                        "pinax/teams/_membership.html",
                        {
                            "membership": membership,
                            "team": self.team
                        },
                        request=self.request
                    )
                }
            })
        return data