def run(self, conn):
        # Attempt to get correct command function.
        func_name = 'cmd_' + self.name
        if not hasattr(conn.server, func_name):
            raise BPDError(ERROR_UNKNOWN, u'unknown command', self.name)
        func = getattr(conn.server, func_name)

        # Ensure we have permission for this command.
        if conn.server.password and \
                not conn.authenticated and \
                self.name not in SAFE_COMMANDS:
            raise BPDError(ERROR_PERMISSION, u'insufficient privileges')

        try:
            args = [conn] + self.args
            results = func(*args)
            if results:
                for data in results:
                    yield conn.send(data)

        except BPDError as e:
            # An exposed error. Set the command name and then let
            # the Connection handle it.
            e.cmd_name = self.name
            raise e

        except BPDClose:
            # An indication that the connection should close. Send
            # it on the Connection.
            raise

        except Exception as e:
            # An "unintentional" error. Hide it from the client.
            log.error('{}', traceback.format_exc(e))
            raise BPDError(ERROR_SYSTEM, u'server error', self.name)
A coroutine that executes the command on the given
dataset/ETHPy150Open beetbox/beets/beetsplug/bpd/__init__.py/Command.run