def METHOD_NAME(schedules: list[dict]) -> str:
    result = "Schedule report:"
    for schedule in sorted(
        schedules, key=lambda s: bool(s["unmatched_users"] or s["migration_errors"])
    ):
        result += "\n" + TAB + format_schedule(schedule)
        if (
            not schedule["unmatched_users"]
            and schedule["oncall_schedule"]
            and not schedule["migration_errors"]
        ):
            result += " (existing schedule with name '{}' will be deleted)".format(
                schedule["oncall_schedule"]["name"]
            )
        for user in schedule["unmatched_users"]:
            result += "\n" + TAB * 2 + format_user(user)
        for error in schedule["migration_errors"]:
            result += "\n" + TAB * 2 + "{} {}".format(ERROR_SIGN, error)
    return result