def METHOD_NAME(request, invoice):
    obj = invoice.get_object()
    search_line_display = None
    if invoice.object_type:
        from django.template.loader import render_to_string
        from django.template import TemplateDoesNotExist
        app_label = invoice.object_type.app_label
        template_name = "%s/invoice_search_result_line.html" % (app_label)
        try:
            search_line_display = render_to_string(
                template_name=template_name,
                context={'obj':obj,'invoice':invoice},
                request=request
            )
        except (TemplateDoesNotExist, IOError):
            pass
    return {'request':request, 'invoice':invoice, 'obj':obj, 'search_line_display':search_line_display}