def get_used_template(response):
if not hasattr(response, '<STR_LIT>'):<EOL><INDENT>return None, None<EOL><DEDENT>template = response.template_name<EOL>if template is None:<EOL><INDENT>return None, None<EOL><DEDENT>if isinstance(template, (list, tuple)):<EOL><INDENT>if len(template) == <NUM_LIT:1>:<EOL><INDENT>return template[<NUM_LIT:0>], None<EOL><DEDENT>else:<EOL><INDENT>used_name = _get_used_template_name(template)<EOL>return used_name, template<EOL><DEDENT><DEDENT>elif isinstance(template, six.string_types):<EOL><INDENT>return template, None<EOL><DEDENT>else:<EOL><INDENT>filename = _get_template_filename(template)<EOL>template_name = '<STR_LIT>'.format(filename) if filename else '<STR_LIT>'<EOL>return template_name, None<EOL><DEDENT>
Get the template used in a TemplateResponse.
This returns a tuple of "active choice, all choices"