code: def template_subst(template, subs, delims=('<', '>')):
      
  
      # Store the template into the working variable
      subst_text = template
  
      # Iterate over subs and perform the .replace() calls
      for (k,v) in subs.items():
          subst_text = subst_text.replace(
                  delims[0] + k + delims[1], v)
      ## next tup
  
      # Return the result
      return subst_text
docs: Perform substitution of content into tagged string.
  
      For substitutions into template input files for external computational
      packages, no checks for valid syntax are performed.
  
      Each key in `subs` corresponds to a delimited
      substitution tag to be replaced in `template` by the entire text of the
      value of that key. For example, the dict ``{"ABC": "text"}`` would
      convert ``The <ABC> is working`` to  ``The text is working``, using the
      default delimiters of '<' and '>'. Substitutions are performed in
      iteration order from `subs`; recursive substitution
      as the tag parsing proceeds is thus
      feasible if an :class:`~collections.OrderedDict` is used and substitution
      key/value pairs are added in the proper order.
  
      Start and end delimiters for the tags are modified by `delims`. For
      example, to substitute a tag of the form **{\|TAG\|}**, the tuple
      ``("{|","|}")`` should be passed to `subs_delims`.  Any elements in
      `delims` past the second are ignored. No checking is
      performed for whether the delimiters are "sensible" or not.
  
      Parameters
      ----------
      template
          |str| --
          Template containing tags delimited by `subs_delims`,
          with tag names and substitution contents provided in `subs`
  
      subs
          |dict| of |str| --
          Each item's key and value are the tag name and corresponding content to
          be substituted into the provided template.
  
      delims
          iterable of |str| --
          Iterable containing the 'open' and 'close' strings used to mark tags
          in the template, which are drawn from elements zero and one,
          respectively. Any elements beyond these are ignored.
  
      Returns
      -------
      subst_text
          |str| --
          String generated from the parsed template, with all tag
          substitutions performed.