code: def expandvars(s, vars=None):
      
      tpl = TemplateWithDefaults(s)
      return tpl.substitute(vars or os.environ)
docs: Perform variable substitution on the given string
  
      Supported syntax:
      * $VARIABLE
      * ${VARIABLE}
      * ${#VARIABLE}
      * ${VARIABLE:-default}
  
      :param s: message to expand
      :type s: str
  
      :param vars: dictionary of variables. Default is ``os.environ``
      :type vars: dict
  
      :return: expanded string
      :rtype: str