<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _update_wikidata(self):
 """ set wikidata from claims and labels """

        claims = self.data['claims']

        for ent in claims:

            plabel = self.data['labels'].get(ent)  # P (property) label
            if plabel:
                plabel = "%s (%s)" % (plabel, ent)

            claim = []
            for item in claims[ent]:
                ilabel = item
                if utils.is_text(item) and re.match(r'^Q\d+$', item):
                    ilabel = self.data['labels'].get(item)  # Q (item) label
                    if ilabel:
                        ilabel = "%s (%s)" % (ilabel, item)

                if len(claims[ent]) == 1:
                    claim = ilabel
                else:
                    claim.append(ilabel)

            if plabel and ilabel:
                self.data['wikidata'][plabel] = claim