You also may be able to skip writing the python script entirely. If you install isctl you can do something like this:
$ isctl get network elementsummary --filter "SwitchType eq 'FabricInterconnect'" -o custom-columns=Name:.Name,FirmwareVersion:.Firmw...