def get_template_data(template_file):
if not pathlib.Path(template_file).exists():<EOL><INDENT>raise ValueError("<STR_LIT>".format(template_file))<EOL><DEDENT>with open(template_file, '<STR_LIT:r>') as fp:<EOL><INDENT>try:<EOL><INDENT>return yaml_parse(fp.read())<EOL><DEDENT>except (ValueError, yaml.YAMLError) as ex:<EOL><INDENT>raise ValueError("<STR_LIT>".format(str(ex)))<EOL><DEDENT><DEDENT>
Read the template file, parse it as JSON/YAML and return the template as a dictionary.

Parameters
----------
template_file : string
    Path to the template to read

Returns
-------
Template data as a dictionary