<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def addParent(self, parent_id):
 """Add a parent to current workitem Notice: for a certain workitem, no more than one parent workitem can be added and specified :param parent_id: the parent workitem id/number (integer or equivalent string) """


        if isinstance(parent_id, bool):
            raise exception.BadValue("Please input a valid workitem id")
        if isinstance(parent_id, six.string_types):
            parent_id = int(parent_id)
        if not isinstance(parent_id, int):
            raise exception.BadValue("Please input a valid workitem id")

        self.log.debug("Try to add a parent <Workitem %s> to current "
                       "<Workitem %s>",
                       parent_id,
                       self)

        headers = copy.deepcopy(self.rtc_obj.headers)
        headers["Content-Type"] = self.OSLC_CR_JSON
        req_url = "".join([self.url,
                           "?oslc_cm.properties=com.ibm.team.workitem.",
                           "linktype.parentworkitem.parent"])

        parent_tag = ("rtc_cm:com.ibm.team.workitem.linktype."
                      "parentworkitem.parent")
        parent_url = ("{0}/resource/itemName/com.ibm.team."
                      "workitem.WorkItem/{1}".format(self.rtc_obj.url,
                                                     parent_id))
        parent_original = {parent_tag: [{"rdf:resource": parent_url}]}

        self.put(req_url,
                 verify=False,
                 proxies=self.rtc_obj.proxies,
                 headers=headers,
                 data=json.dumps(parent_original))
        self.log.info("Successfully add a parent <Workitem %s> to current "
                      "<Workitem %s>",
                      parent_id,
                      self)