'Run a Rekall plugin and return the result.'

def Run(self, args):

    session_args = args.session.ToDict()
    if (('filename' not in session_args) and args.device):
        session_args['filename'] = args.device.path
    rekal_session = GrrRekallSession(action=self, initial_profiles=args.profiles, **session_args)
    plugin_errors = []
    for plugin_request in args.plugins:
        plugin_args = plugin_request.args.ToDict()
        try:
            rekal_session.RunPlugin(plugin_request.plugin, **plugin_args)
        except Exception:
            tb = traceback.format_exc()
            logging.error('While    running    plugin    (%s):    %s', plugin_request.plugin, tb)
            plugin_errors.append(tb)
        finally:
            rekal_session.Flush()
    if plugin_errors:
        self.SetStatus(rdf_flows.GrrStatus.ReturnedStatus.GENERIC_ERROR, u'\n\n'.join(plugin_errors))
    self.Progress()
    self.ForceGC()
