<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _run(broker, graph=None, root=None, context=None, inventory=None):
 """ run is a general interface that is meant for stand alone scripts to use when executing insights components. Args: root (str):
 None will causes a host collection in which command and file specs are run. A directory or archive path will cause collection from the directory or archive, and only file type specs or those that depend on `insights.core.context.HostArchiveContext` will execute. component (function or class):
 The component to execute. Will only execute the component and its dependency graph. If None, all components with met dependencies will execute. Returns: broker: object containing the result of the evaluation. """


    if not root:
        context = context or HostContext
        broker[context] = context()
        return dr.run(graph, broker=broker)

    if os.path.isdir(root):
        return process_dir(broker, root, graph, context, inventory=inventory)
    else:
        with extract(root) as ex:
            return process_dir(broker, ex.tmp_dir, graph, context, inventory=inventory)