code: def validate_link(link_data):
      
      from django.apps import apps
  
      try:
          Model = apps.get_model(*link_data['model'].split('.'))
          Model.objects.get(pk=link_data['pk'])
      except Model.DoesNotExist:
          raise ValidationError(_("Unable to link onto '{0}'.").format(Model.__name__))
docs: Check if the given model exists, otherwise raise a Validation error