code: def replace_variables(self, source: str, variables: dict) -> str:
          
          try:
              replaced = re.sub(
                  "{{(.*?)}}", lambda m: variables.get(m.group(1), ""), source
              )
          except TypeError:
              replaced = source
          return replaced
docs: Replace {{variable-name}} with stored value.