def execute(self):
        if not self.args:
            self.pc.update_output('Bestow what authority upon whom?\n')
            return
        exp = r'(?P<permission>(god)|(dm)|(builder)|(admin))[ ]?(to)?(on)?(upon)?([ ]+(?P<npc>npc))?([ ]+(?P<player>\w+))'
        match = re.match(exp, self.args.lower(), re.I)
        if not match:
            self.pc.update_output('Type "help bestow" for help on this command.')
            return
        perm, npc, player = match.group('permission', 'npc', 'player')
        if npc:
            error = 'Npc doesn\'t exist.'
            if not self.pc.location:
                self.pc.update_output(error)
                return
            player = self.pc.location.get_npc_by_kw(player)
            self.pc.update_output('WARNING: giving npcs wider permissions can be dangerous. See "help bestow".')
        else:
            player = self.world.get_player(player)
        permission = globals().get(perm.upper())
        if not player:
            self.pc.update_output('That player isn\'t on right now.')
            return
        if not permission:
            self.pc.update_output('Valid permission types are: god, dm, builder, and admin.')
            return
        if player.permissions & permission:
            self.pc.update_output('%s already has that authority.' % player.fancy_name())
            return
        player.permissions = player.permissions | permission
        if not player.is_npc():
            player.save()
        self.world.play_log.info('%s bestowed the authority of %s upon %s.' % (
                    self.pc.fancy_name(), perm.upper(), player.fancy_name()))
        self.pc.update_output('%s now has the privilige of being %s.' % (player.fancy_name(), perm.upper()))
        player.update_output('%s has bestowed the authority of %s upon you!' % (self.pc.fancy_name(), perm.upper()))
        self.world.tell_players('%s has bestowed the authority of %s upon %s!' %
                              (self.pc.fancy_name(), perm.upper(), player.fancy_name()),
                              [self.pc.name, player.name])
dataset/ETHPy150Open shinymud/ShinyMUD/src/shinymud/commands/commands.py/Bestow.execute/original