There is no Python method to trim objects. To extrude objects use the extrude method of the Draft module.
extrude