def str_format(text, data, enc_char):
  """This takes a text template, and formats the encapsulated occurences with data keys
  Example: if text = 'My name is $$name$$', provided data = 'Bob' and enc_char = '$$'.
    the returned text will be 'My name is Bob'.
  """
  for key in data:
    val = data[key]
    text = text.replace('{}{}{}'.format(enc_char, str(key), enc_char),
                        str(val))
  return text