def METHOD_NAME(single_school=None):
    """Get percentile rankings for schools by degree, control, and state."""
    count = 0
    starter = datetime.datetime.now()
    base_query = build_base_cohorts()
    if single_school:
        base_query = base_query.filter(pk=single_school)
    for school in base_query:
        by_degree = {}
        by_state = {}
        by_control = {}
        count += 1
        if count % 500 == 0:  # pragma: no cover
            logger.info("{} schools processed".format(count))
        # degree_cohort is the default, national base cohort
        # base query weeds out schools without state or degrees_highest values
        degree_cohort = DEGREE_COHORTS.get(get_grad_level(school))
        state_cohort = [
            s
            for s in degree_cohort
            if s and s.state and s.state == school.state
        ]
        # For school control, we want cohorts only for public and private;
        # We do not want a special cohort of for-profit schools
        if not school.control:
            control_cohort = None
        elif school.control == "Public":
            control_cohort = [
                s for s in degree_cohort if s.control == school.control
            ]
        else:
            control_cohort = [
                s for s in degree_cohort if s.control != "Public"
            ]
        for metric in ["grad_rate", "repay_3yr", "median_total_debt"]:
            if getattr(school, metric) is None:
                by_state.update({metric: None})
                by_control.update({metric: None})
                by_degree.update({metric: None})
            else:
                if state_cohort:
                    by_state.update(
                        {metric: rank_by_metric(school, state_cohort, metric)}
                    )
                if control_cohort:
                    by_control.update(
                        {
                            metric: rank_by_metric(
                                school, control_cohort, metric
                            )
                        }
                    )
                if degree_cohort:
                    by_degree.update(
                        {metric: rank_by_metric(school, degree_cohort, metric)}
                    )
        school.cohort_ranking_by_state = by_state
        school.cohort_ranking_by_control = by_control
        school.cohort_ranking_by_highest_degree = by_degree
        school.save()
    logger.info(
        "\nCohort script took {} to process {} schools".format(
            datetime.datetime.now() - starter, count
        )
    )