# Gridifying Objects using BMesh

I'm working on a script which generates a bunch of cuboids with integer length sides. From there I would like to effectively turn each face into a grid in which each vertex is aligned to the world grid (i.e. on each integer coordinate). Currently I have been looking at using the subdivide operation (bmesh.ops.subdivide_edges) to make this work, but this seems long-winded and time-consuming (requires getting all the edges from each operation, finding out which to use for the next, etc). Is there a better way of doing this, or would it be easier to do repeated extrusion when constructing the cuboid (i.e. extrude by 1, n times, rather than extrude by n once)? The way I would do this manually is using a loop cut, can this be done with bmesh?

For info, I'm using blender 2.81a and hoping to do this purely within bmesh.