Without creating anything too complicated, you can run this script and with a little mesh cleanup you can get something close. Make it in a new scene because it will remove everything in the scene.

import bpy
def create_genus_3_surface():
# Clear existing mesh objects
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
# Create first torus
bpy.ops.mesh.primitive_torus_add(
align='WORLD', location=(0, 0, 0),
rotation=(0, 0, 0),
major_radius=2, minor_radius=0.5
)
torus1 = bpy.context.object
# Create second torus
bpy.ops.mesh.primitive_torus_add(
align='WORLD', location=(4, 0, 0),
rotation=(0, 0, 0),
major_radius=2, minor_radius=0.5
)
torus2 = bpy.context.object
# Create third torus
bpy.ops.mesh.primitive_torus_add(
align='WORLD', location=(2, 4, 0),
rotation=(0, 0, 0),
major_radius=2, minor_radius=0.5
)
torus3 = bpy.context.object
# Use boolean modifiers to merge the tori
torus1.modifiers.new(name="BooleanTorus2", type='BOOLEAN')
torus1.modifiers["BooleanTorus2"].operation = 'UNION'
torus1.modifiers["BooleanTorus2"].object = torus2
bpy.ops.object.modifier_apply({"object": torus1}, modifier="BooleanTorus2")
torus1.modifiers.new(name="BooleanTorus3", type='BOOLEAN')
torus1.modifiers["BooleanTorus3"].operation = 'UNION'
torus1.modifiers["BooleanTorus3"].object = torus3
bpy.ops.object.modifier_apply({"object": torus1}, modifier="BooleanTorus3")
# Delete the original second and third tori
bpy.ops.object.select_all(action='DESELECT')
torus2.select_set(True)
torus3.select_set(True)
bpy.ops.object.delete()
# Apply a smooth shading to the final object
bpy.ops.object.select_all(action='DESELECT')
torus1.select_set(True)
bpy.ops.object.shade_smooth()
# Optionally, add a subdivision surface modifier to further smooth the result
torus1.modifiers.new(name="Subdivision", type='SUBSURF')
torus1.modifiers["Subdivision"].levels = 2
torus1.modifiers["Subdivision"].render_levels = 2
# Call the function
create_genus_3_surface()