<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _context_build(self, pending=False):
 """ Create a context dict from standard legion configuration. The context is constructed in a standard way and is passed to str.format() on configuration. The context consists of the entire os.environ, the config 'defines', and a set of pre-defined values which have a common prefix from 'context_prefix'. This is similar to the task conext but without the task-specific entries. """

        log = self._params.get('log', self._discard)
        log.debug("called with pending=%s", pending)
        if pending:
            conf = self._config_pending
        else:
            conf = self._config_running
        if not conf:
            log.warning("No config available")
            conf = {}

        #  Build context used to format process args.
        #
        context = {
            context_prefix+'host': self.host,
            context_prefix+'fqdn': self.fqdn
        }

        #  Add the environment to the context
        #
        context.update(os.environ)

        if conf:
            self._context_defines(context, conf)
            self._context_defaults(context, conf)
        else:
            log.warning("No legion config available for defines")
        return context