def METHOD_NAME(obj):
    if obj.content_type.model == "service":
        yield from service(obj.content_object)
    if obj.content_type.model == "project":
        yield from project(obj.content_object)