Get templates from a group of to-be-copied :class:`Workitems` and
        write them to files named after the names in `template_names`
        respectively.

        :param workitems: a :class:`list`/:class:`tuple`/:class:`set`
            contains the ids (integer or equivalent string) of some
            to-be-copied :class:`Workitems`
        :param template_names: a :class:`list`/:class:`tuple`/:class:`set`
            contains the template file names for copied :class:`Workitems`.
            If `None`, the new template files will be named after the
            :class:`rtcclient.workitem.Workitem` id with "`.template`" as a
            postfix
        :param template_folder: refer to
            :class:`rtcclient.template.Templater.getTemplate`
        :param keep: (default is False) refer to
            :class:`rtcclient.template.Templater.getTemplate`
        :param encoding: (default is "UTF-8") refer to
            :class:`rtcclient.template.Templater.getTemplate`

def getTemplates(self, workitems, template_folder=None,
                     template_names=None, keep=False, encoding="UTF-8"):
        """Get templates from a group of to-be-copied :class:`Workitems` and
        write them to files named after the names in `template_names`
        respectively.

        :param workitems: a :class:`list`/:class:`tuple`/:class:`set`
            contains the ids (integer or equivalent string) of some
            to-be-copied :class:`Workitems`
        :param template_names: a :class:`list`/:class:`tuple`/:class:`set`
            contains the template file names for copied :class:`Workitems`.
            If `None`, the new template files will be named after the
            :class:`rtcclient.workitem.Workitem` id with "`.template`" as a
            postfix
        :param template_folder: refer to
            :class:`rtcclient.template.Templater.getTemplate`
        :param keep: (default is False) refer to
            :class:`rtcclient.template.Templater.getTemplate`
        :param encoding: (default is "UTF-8") refer to
            :class:`rtcclient.template.Templater.getTemplate`
        """

        if (not workitems or isinstance(workitems, six.string_types) or
                isinstance(workitems, int) or
                isinstance(workitems, float) or
                not hasattr(workitems, "__iter__")):
            error_msg = "Input parameter 'workitems' is not iterable"
            self.log.error(error_msg)
            raise exception.BadValue(error_msg)

        if template_names is not None:
            if not hasattr(template_names, "__iter__"):
                error_msg = "Input parameter 'template_names' is not iterable"
                self.log.error(error_msg)
                raise exception.BadValue(error_msg)

            if len(workitems) != len(template_names):
                error_msg = "".join(["Input parameters 'workitems' and ",
                                     "'template_names' have different length"])
                self.log.error(error_msg)
                raise exception.BadValue(error_msg)

        for index, wk_id in enumerate(workitems):
            try:
                if template_names is not None:
                    template_name = template_names[index]
                else:
                    template_name = ".".join([wk_id, "template"])
                self.getTemplate(wk_id,
                                 template_name=template_name,
                                 template_folder=template_folder,
                                 keep=keep,
                                 encoding=encoding)
            except Exception as excp:
                self.log.error("Exception occurred when fetching"
                               "template from <Workitem %s>: %s",
                               str(wk_id), excp)
                continue
        self.log.info("Successfully fetch all the templates from "
                      "workitems: %s", workitems)