This sidemod stores the Held Item state of all Pokemon at the beginning of a battle, and then restores any items that are missing/different from the initial state back to their origin.
Held items stored at the beginning, compared at the end, and then any inconsistencies will be restored to their original state.