code: def invert_relation(self, relation):
          
          if self.is_relation_inverted(relation):
              rel = self._deinversions.get(relation, relation[:-3])
          else:
              rel = self._inversions.get(relation, relation + '-of')
          if rel is None:
               raise PenmanError(
                  'Cannot (de)invert {}; not allowed'.format(relation)
              )
          return rel
docs: Invert or deinvert *relation*.