code: def _validate_ctypes(self, from_obj, to_obj):
          
          if from_obj:
              from_ctype = ContentType.objects.get_for_model(from_obj)
              assert from_ctype.natural_key() == self.from_content_type.natural_key(), (
                  'Relationship "%s" does not support connections '
                  'from "%s" types' % (self.name, from_ctype))
          if to_obj:
              to_ctype = ContentType.objects.get_for_model(to_obj)
              assert to_ctype.natural_key() == self.to_content_type.natural_key(), (
                  'Relationship "%s" does not support connections '
                  'to "%s" types' % (self.name, to_ctype))
docs: Asserts that the content types for the given object are valid for this
          relationship. If validation fails, ``AssertionError`` will be raised.