def get_model_instance(app_label, model_name, pk):
    """
    Find an object instance given an app_label, a model name and the
    object's pk.

    This is used for page's get_link_target but can be used for other
    content types that accept e.g. either an internal or external link.
    """

    model = apps.get_model(app_label, model_name)
    if not model:
        return None

    try:
        instance = model._default_manager.get(pk=pk)
        return instance
    except model.DoesNotExist:
        pass

    return None

    Find an object instance given an app_label, a model name and the
    object's pk.

    This is used for page's get_link_target but can be used for other
    content types that accept e.g. either an internal or external link.
    
feincms/utils/__init__.py