def METHOD_NAME(self, one, module, result):
    params = module.params
    id = params.get('id')
    name = params.get('name')
    desired_state = params.get('state')
    template_data = params.get('template')
    self.result = {}
    template = self.get_template_instance(id, name)
    needs_creation = False
    if not template and desired_state != 'absent':
        if id:
            module.fail_json(msg="There is no template with id=" + str(id))
        else:
            needs_creation = True
    if desired_state == 'absent':
        self.result = self.delete_template(template)
    else:
        if needs_creation:
            self.result = self.create_template(name, template_data)
        else:
            self.result = self.update_template(template, template_data)
    self.exit()