def METHOD_NAME(old_version, new_version, app_configs=None):
    def filter_upgrade(upgrade):
        return (
            # Only import upgrades that match the old version
            # that is being upgraded from
            matches_version(old_version, upgrade.OLD_VERSION)
            # Only import upgrades that match the new version
            # that is being upgraded to
            and matches_version(new_version, upgrade.NEW_VERSION)
        )
    # Only run upgrades if we had a previous version, otherwise
    # we're just upgrading from a blank slate, so no need to run anything
    if old_version:
        for version_upgrade in sorted(
            filter(filter_upgrade, get_upgrades(app_configs=app_configs))
        ):
            version_upgrade()