r'''
    Return the template id for a VM.

    .. versionadded:: 2016.11.0

    vm\_
        The VM dictionary for which to obtain a template.

def get_template(vm_):
    r'''
    Return the template id for a VM.

    .. versionadded:: 2016.11.0

    vm\_
        The VM dictionary for which to obtain a template.
    '''

    vm_template = six.text_type(config.get_cloud_config_value(
        'template', vm_, __opts__, search_global=False
    ))
    try:
        return list_templates()[vm_template]['id']
    except KeyError:
        raise SaltCloudNotFound(
            'The specified template, \'{0}\', could not be found.'.format(vm_template)
        )