'Determine item\'s amount to keep in inventory.
:param item:
:return: Item\'s amount to keep in inventory.
:rtype: int'

def get_amount_to_keep(self, item):

    item_filter_config = self.items_filter.get(item.name, 0)
    if (item_filter_config is not 0):
        return item_filter_config.get('keep', 20)
    else:
        item_filter_config = self.items_filter.get(str(item.id), 0)
        if (item_filter_config is not 0):
            return item_filter_config.get('keep', 20)
