This command causes all the 3d views to save their settings as optionVar’s. This is called automatically by the system when Maya exits.
Derived from mel command maya.cmds.saveViewportSettings
Example:
import pymel.core as pm
pm.saveViewportSettings()