Stores the cursor item or drops it if the inventory is full.
        Tip: look directly up or down before calling this, so you can
        pick up the dropped item when the inventory frees up again.

        Returns:
            Slot: The slot used to store it, or None if dropped.

def store_or_drop(self):
        """
        Stores the cursor item or drops it if the inventory is full.
        Tip: look directly up or down before calling this, so you can
        pick up the dropped item when the inventory frees up again.

        Returns:
            Slot: The slot used to store it, or None if dropped.
        """
        inv = self.inventory
        if inv.cursor_slot.is_empty:  # nothing to drop
            raise StopIteration(None)

        storage = inv.inv_slots_preferred
        if inv.window.is_storage:
            storage += inv.window.window_slots
        first_empty_slot = inv.find_slot(constants.INV_ITEMID_EMPTY, storage)
        if first_empty_slot is not None:
            yield self.click_slot(first_empty_slot)
        else:
            yield self.drop_slot(drop_stack=True)

        if not inv.cursor_slot.is_empty:
            raise TaskFailed('Store or Drop failed: cursor is not empty')

        raise StopIteration(first_empty_slot)