code: def get_election(self, row, race):
          
          election_day = election.ElectionDay.objects.get(
              date=row["electiondate"]
          )
  
          if row["racetypeid"] in ["D", "E"]:
              party = government.Party.objects.get(ap_code="Dem")
          elif row["racetypeid"] in ["R", "S"]:
              party = government.Party.objects.get(ap_code="GOP")
          else:
              party = None
  
          if row["racetype"] == "Runoff" and party:
              election_type = election.ElectionType.objects.get_or_create(
                  slug=election.ElectionType.PRIMARY_RUNOFF,
                  label="Primary Runoff",
                  number_of_winners=1,
              )[0]
  
              return election.Election.objects.get_or_create(
                  election_type=election_type,
                  election_day=election_day,
                  division=race.office.division,
                  race=race,
                  party=party,
              )[0]
  
          try:
              return election.Election.objects.get(
                  election_day=election_day,
                  division=race.office.division,
                  race=race,
                  party=party,
              )
          except ObjectDoesNotExist:
              print(
                  "Could not find election for {0} {1} {2}".format(
                      race, row["party"], row["last"]
                  )
              )
              return None
docs: Gets the Election object for the given row of election results.
          Depends on knowing the Race object.
  
          If this is the presidential election, this will determine the
          Division attached to the election based on the row's statename.
  
          This function depends on knowing the Race object from `get_race`.