Curved Cube Mesh Script Help

Hi,
I’m trying to create a mesh object that looks like this:

My initial idea was to create a cube (scale the x,y,z axis so that is looks like a flat rectangle) and curve it. I was able to curve it by moving the actual cube through a Bezier Curve (as detailed in this example: http://www.blendernewbies.com/tutorials/swf/object_follow_curve/object_following_curve.html) but I was wondering how it can be down only using scripts. I realized moving the object along the curve and setting up the curve is done by “eye-balling” the rotations and transformations.

Also, I was wondering if anyone had any suggestions on how to get the “grid” effect applied to this cube?
Any help would be much appreciated.
Thanks!