<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def complement(self):
 """Return the complementary relationship of self. Raises: ValueError: if the relationship has a complementary which was not defined. Returns: complementary (Relationship):
 the complementary relationship. Example: Relationship('part_of') None """

        if self.complementary:

            #if self.complementary in self._instances.keys():
            try:
                return self._instances[self.complementary]
            except KeyError:
                raise ValueError('{} has a complementary but it was not defined !')

        else:
            return None