Check which of the world coordinate systems of the category "Settings" is set in the Maya menu [Window]-[Settings / Preferences]-[Preferences].
import maya.cmds as cmds
if cmds.upAxis(query=True, axis=True) == "y":
print "Y UP"
else:
print "Z UP"