def METHOD_NAME(
    self,
    include_descriptions=True,
    exclude_deregistered=False,
    include_description_ids=False,
    include_non_current=True,
    extra_party_ids=None,
):
    # For various reasons, we've found it's best to order the
    # parties by those that have the most candidates - this means
    # that the commonest parties to select are at the top of the
    # drop down.  The logic here tries to build such an ordered
    # list of candidates if there are enough that such an ordering
    # makes sense.  Otherwise the fallback is to rank
    # alphabetically.
    party_filter_kwargs = {}
    party_order_by = ["name"]
    if include_non_current:
        party_order_by.insert(0, "-total_candidates")
    else:
        party_filter_kwargs["current_candidates__gt"] = 0
        party_order_by.insert(0, "-current_candidates")
    parties_current_qs = (
        self.filter(**party_filter_kwargs)
        .order_by(*party_order_by)
        .only("date_deregistered", "name", "ec_id", "register")
    )
    if not extra_party_ids:
        extra_party_ids = []
    if isinstance(extra_party_ids, tuple):
        extra_party_ids = list(extra_party_ids)
    extra_party_ids.append("ynmp-party:2")
    extra_qs = self.model.objects.filter(ec_id__in=extra_party_ids)
    parties_current_qs = extra_qs | parties_current_qs
    if include_descriptions:
        parties_current_qs = parties_current_qs.prefetch_related(
            "descriptions"
        )
    result = [("", {"label": ""})]
    for party in parties_current_qs:
        if (
            party.date_deregistered
            and party.is_deregistered
            and exclude_deregistered
        ):
            continue
        if include_descriptions and party.descriptions.exists():
            names = [
                (
                    party.ec_id,
                    {
                        "label": party.format_name,
                        "register": party.register or "all",
                    },
                )
            ]
            for description in party.descriptions.all():
                joint_text = re.compile(JOINT_DESCRIPTION_REGEX, re.I)
                party_id_str = str(party.ec_id)
                if include_description_ids:
                    party_id_str = "{}__{}".format(
                        party_id_str, description.pk
                    )
                if not joint_text.search(description.description):
                    names.append(
                        (
                            party_id_str,
                            {
                                "label": description.description,
                                "register": party.register or "all",
                            },
                        )
                    )
            party_names = (party.format_name, names)
        else:
            party_names = (
                str(party.ec_id),
                {
                    "label": party.format_name,
                    "register": party.register or "all",
                },
            )
        result.append(party_names)
    return result