code: def expand_templates(pars, context, return_left=False, client=False,
                       getenv=True, getshell=True):
      
      all_vars = set(context)
      out = _expand(pars, context, all_vars, client, getenv, getshell)
      if return_left:
          return out, all_vars
      return out
docs: Render variables in context into the set of parameters with jinja2.
  
      For variables that are not strings, nothing happens.
  
      Parameters
      ----------
      pars: dict
          values are strings containing some jinja2 controls
      context: dict
          values to use while rendering
      return_left: bool
          whether to return the set of variables in context that were not used
          in rendering parameters
  
      Returns
      -------
      dict with the same keys as ``pars``, but updated values; optionally also
      return set of unused parameter names.