def verify_merchant(self, merchant_name):
        """Return a merchant if there is a valid one, """
        # If the player specified a merchant, try to grab that one
        if merchant_name:
            merchant = self.pc.location.get_npc_by_kw(merchant_name)
            if not merchant:
                raise SaleFail('%s isn\'t here.' % merchant_name)
            elif not merchant.has_ai('merchant'):
                raise SaleFail((merchant.name) % '%s isn\'t a merchant.')
            else:
                return merchant
        # if they didn't list a merchant, grab the first npc merchant you 
        # can find in the room
        else:
            merchant = None
            for npc in self.pc.location.npcs:
                if npc.has_ai('merchant'):
                    merchant = npc
                    break
            if not merchant:
                raise SaleFail('There aren\'t any merchants here to buy from.')
            else:
                return merchant
dataset/ETHPy150Open shinymud/ShinyMUD/src/shinymud/commands/commands.py/Buy.verify_merchant/swapped operands of `%`