code: def extract_vars(template):
      
      keys = set()
      for match in re.finditer(r"\{\{ (?P<key>\w+) \}\}", template.getvalue()):
          keys.add(match.groups()[0])
      return sorted(list(keys))
docs: Extract variables from template. Variables are enclosed in
          double curly braces.