Creates and returns a function that takes a slot
    and checks if it matches the wanted item.

    Args:
        wanted: function(Slot) or Slot or itemID or (itemID, metadata)

def make_slot_check(wanted):
    """
    Creates and returns a function that takes a slot
    and checks if it matches the wanted item.

    Args:
        wanted: function(Slot) or Slot or itemID or (itemID, metadata)
    """
    if isinstance(wanted, types.FunctionType):
        return wanted  # just forward the slot check function

    if isinstance(wanted, int):
        item, meta = wanted, None
    elif isinstance(wanted, Slot):
        item, meta = wanted.item_id, wanted.damage  # TODO compare NBT
    elif isinstance(wanted, (Item, Block)):
        item, meta = wanted.id, wanted.metadata
    elif isinstance(wanted, str):
        item_or_block = get_item_or_block(wanted, init=True)
        item, meta = item_or_block.id, item_or_block.metadata
    else:  # wanted is (id, meta)
        try:
            item, meta = wanted
        except TypeError:
            raise ValueError('Illegal args for make_slot_check(): %s' % wanted)

    return lambda slot: item == slot.item_id and meta in (None, slot.damage)