# Path: vitrageclient/common/utils.py
# def args_to_dict(args, attrs):
# def list2cols(cols, objs):
# def list2cols_with_rename(names_and_keys, objs):
# def get_client(obj):
# def wait_for_action_to_end(timeout, func, **kwargs):
# def find_template_with_uuid(uuid, templates):
# 
# Path: vitrageclient/common/utils.py
# def find_template_with_uuid(uuid, templates):
#     return next(
#         (
#             template
#             for template in templates
#             if template['uuid'] == uuid
#         ), None
#     )


import sys
from cliff import command
from cliff import lister
from cliff import show
from oslo_log import log
from vitrageclient.common import utils
from vitrageclient.common.utils import find_template_with_uuid

        templates = utils.get_client(self).template.add(
            path=path, template_type=template_type, params=params,
            overwrite=overwrite)

        if wait:
            utils.wait_for_action_to_end(wait,
                                         self._check_finished_loading,
                                         templates=templates)

        return utils.list2cols_with_rename(
            (
                ('UUID', 'uuid'),
                ('Name', 'name'),
                ('Status', 'status'),
                ('Status details', 'status details'),
                ('Date', 'date'),
                ('Type', 'type'),
            ), templates)

    def _check_finished_loading(self, templates):
        if all(
                (
                    template['status'] == 'ERROR'
                    for template in templates
                )
        ):
            return True

        try:

# Path: vitrageclient/common/utils.py
# def args_to_dict(args, attrs):
# def list2cols(cols, objs):
# def list2cols_with_rename(names_and_keys, objs):
# def get_client(obj):
# def wait_for_action_to_end(timeout, func, **kwargs):
# def find_template_with_uuid(uuid, templates):
# 
# Path: vitrageclient/common/utils.py
# def find_template_with_uuid(uuid, templates):
#     return next(
#         (
#             template
#             for template in templates
#             if template['uuid'] == uuid
#         ), None
#     )


# Path: vitrageclient/v1/cli/template.py
import sys
from cliff import command
from cliff import lister
from cliff import show
from oslo_log import log
from vitrageclient.common import utils
from vitrageclient.common.utils import find_template_with_uuid


        templates = utils.get_client(self).template.add(
            path=path, template_type=template_type, params=params,
            overwrite=overwrite)

        if wait:
            utils.wait_for_action_to_end(wait,
                                         self._check_finished_loading,
                                         templates=templates)

        return utils.list2cols_with_rename(
            (
                ('UUID', 'uuid'),
                ('Name', 'name'),
                ('Status', 'status'),
                ('Status details', 'status details'),
                ('Date', 'date'),
                ('Type', 'type'),
            ), templates)

    def _check_finished_loading(self, templates):
        if all(
                (
                    template['status'] == 'ERROR'
                    for template in templates
                )
        ):
            return True

        try:

            api_templates = utils.get_client(self).template.list()