<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_or_create_party(self, row):
 """ Gets or creates the Party object based on AP code of the row of election data. All parties that aren't Democratic or Republican are aggregable. """

        if row["party"] in ["Dem", "GOP"]:
            aggregable = False
        else:
            aggregable = True

        defaults = {"label": row["party"], "aggregate_candidates": aggregable}

        party, created = government.Party.objects.get_or_create(
            ap_code=row["party"], defaults=defaults
        )

        return party