def METHOD_NAME(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)
    )