<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_division(self, row):
 """ Gets the Division object for the given row of election results. """


        # back out of Alaska county

        if (
            row["level"] == geography.DivisionLevel.COUNTY
            and row["statename"] == "Alaska"
        ):
            print("Do not take the Alaska county level result")
            return None

        kwargs = {"level__name": row["level"]}

        if row["reportingunitname"]:
            name = row["reportingunitname"]
        else:
            name = row["statename"]

        if row["level"] in [
            geography.DivisionLevel.COUNTY,
            geography.DivisionLevel.TOWNSHIP,
        ]:
            kwargs["code"] = row["fipscode"]
        else:
            kwargs["name"] = name
        try:
            return geography.Division.objects.get(**kwargs)
        except ObjectDoesNotExist:
            return None