def METHOD_NAME(self, *args, **options):
    # Step 1: Set all CEDs to ENG, as CEDs are only ever in England
    self.stdout.write("Updating from CEDs")
    OrganisationDivision.objects.filter(division_type="CED").filter(
        territory_code=""
    ).update(territory_code="ENG")
    # Step 2: Guess from GSS codes
    self.stdout.write("Guessing from GSS codes")
    self.guess_from_gss()
    # Step 3: Use constituencies as parents. This catches a load of divisions
    # without using too much CPU to find them
    self.stdout.write("Assigning form parl constituencies")
    parl = Organisation.objects.get(slug="parl")
    constituencies: List[OrganisationDivision] = (
        parl.divisionset.get(start_date="2010-05-06")
        .divisions.all()
        .select_related("geography")
    )
    for constituency in constituencies:
        self.assign_territory_code(constituency)
    # Step 4: Loop over all remaining divisions and find a parent with a known code
    self.stdout.write("Assigning from parents")
    self.assign_from_parents()
    # Step 5: Loop over all remaining divisions and find a parent by the centre
    # of the geography
    self.stdout.write("Assigning from parents by centres")
    self.assign_by_centre()
    divisions_missing_territory_code = OrganisationDivision.objects.filter(
        territory_code=""
    )
    if divisions_missing_territory_code.exists():
        missing_count = divisions_missing_territory_code.count()
        self.stdout.write(
            f"WARNING: {missing_count} are STILL missing a territory_code "
        )
    else:
        self.stdout.write("GOOD NEWS! All divisions have a territory code.")