<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def createWorkitem(self, item_type, title, description=None, projectarea_id=None, projectarea_name=None, template=None, copied_from=None, keep=False, **kwargs):
 """Create a workitem :param item_type: the type of the workitem (e.g. task/defect/issue) :param title: the title of the new created workitem :param description: the description of the new created workitem :param projectarea_id: the :class:`rtcclient.project_area.ProjectArea` id :param projectarea_name: the project area name :param template: The template to render. The template is actually a file, which is usually generated by :class:`rtcclient.template.Templater.getTemplate` and can also be modified by user accordingly. :param copied_from: the to-be-copied workitem id :param keep: refer to `keep` in :class:`rtcclient.template.Templater.getTemplate`. Only works when `template` is not specified :param \*\*kwargs: Optional/mandatory arguments when creating a new workitem. More details, please refer to `kwargs` in :class:`rtcclient.template.Templater.render` :return: the :class:`rtcclient.workitem.Workitem` object :rtype: rtcclient.workitem.Workitem """


        if not isinstance(projectarea_id,
                          six.string_types) or not projectarea_id:
            projectarea = self.getProjectArea(projectarea_name)
            projectarea_id = projectarea.id
        else:
            projectarea = self.getProjectAreaByID(projectarea_id)

        itemtype = projectarea.getItemType(item_type)

        if not template:
            if not copied_from:
                self.log.error("Please choose either-or between "
                               "template and copied_from")
                raise exception.EmptyAttrib("At least choose either-or "
                                            "between template and copied_from")

            self._checkMissingParamsFromWorkitem(copied_from, keep=keep,
                                                 **kwargs)
            kwargs = self._retrieveValidInfo(projectarea_id,
                                             **kwargs)
            wi_raw = self.templater.renderFromWorkitem(copied_from,
                                                       keep=keep,
                                                       encoding="UTF-8",
                                                       title=title,
                                                       description=description,
                                                       **kwargs)

        else:
            self._checkMissingParams(template, **kwargs)
            kwargs = self._retrieveValidInfo(projectarea_id,
                                             **kwargs)
            wi_raw = self.templater.render(template,
                                           title=title,
                                           description=description,
                                           **kwargs)

        self.log.info("Start to create a new <%s> with raw data: %s",
                      item_type, wi_raw)

        wi_url_post = "/".join([self.url,
                                "oslc/contexts",
                                projectarea_id,
                                "workitems/%s" % itemtype.identifier])
        return self._createWorkitem(wi_url_post, wi_raw)