'Create a template from a snapshot
:param      snapshot: Instance of ``VolumeSnapshot``
:type       volume: ``VolumeSnapshot``
:param  name: the name of the template
:type   name: ``str``
:param  name: the os type id
:type   name: ``str``
:param  name: the display name of the template
:type   name: ``str``
:rtype: :class:`NodeImage`'

def ex_create_snapshot_template(self, snapshot, name, ostypeid, displaytext=None):

    if (not displaytext):
        displaytext = name
    resp = self._async_request(command='createTemplate', params={'displaytext': displaytext, 'name': name, 'ostypeid': ostypeid, 'snapshotid': snapshot.id})
    img = resp.get('template')
    extra = {'hypervisor': img['hypervisor'], 'format': img['format'], 'os': img['ostypename'], 'displaytext': img['displaytext']}
    return NodeImage(id=img['id'], name=img['name'], driver=self.connection.driver, extra=extra)
