Exporting Landscape and portrait maps using arpy.datadrivenpages

Scenario: I am using data driven pages to export to PDF. Each PDF focuses on a single polygon (in this case a postal zone) along with the relative background map. Of the 18000 polygons, 8000 would best suite a Portrait layout and 10000 would be landscape. The orientation preference is already the the data driven pages index layer. The two mxd's are identical except for their layout.

My Aim:I am trying to write a python script that would allow me to export a selection of polygons (either by a simple selection or a definition query), using the correct layout. I would be in one of the mxd's when running this script.