code: def _extract_variables(param):
      
  
      variables = set()
  
      if isinstance(param, list):
          variables.update(*[_extract_variables(x) for x in param])
      elif isinstance(param, dict):
          variables.update(*[_extract_variables(x) for x in param.values()])
      elif isinstance(param, str):
          for match in re.finditer(TEMPLATE_REGEX, param):
              if match.group('short_id') is not None:
                  variables.add(match.group('short_id'))
              else:
                  variables.add(match.group('long_id'))
  
      return variables
docs: Find all template variables in args.