def sanitize_for_boolean(o):
    """
    Attempt to clean up `o` to make boolean operations more likely to succeed
    """

    with butil.SelectObjects(o), logging_util.Suppress():
        bpy.ops.object.transform_apply(scale=True)
        bpy.ops.object.mode_set(mode="EDIT")
        bpy.ops.mesh.select_all()
        bpy.ops.mesh.remove_doubles()
        bpy.ops.mesh.normals_make_consistent(inside=False)
        bpy.ops.object.mode_set(mode="OBJECT")

    Attempt to clean up `o` to make boolean operations more likely to succeed
    
infinigen/assets/objects/creatures/util/creature.py