Thanks @Miquel
If anyone needs this kind of functionality here is the script I used:
import pymel.core as pm
print 'POST: Head isolate script'
# control to isolate
isolate_ctrl = pm.PyNode('neck_C0_fk0_ctl')
# spaces to add to isolation
global_ctrl = pm.PyNode('cog_C0_ctl')
parent_ctrl = pm.PyNode('spine_C0_ik1_ctl')
isolate_constrain_grp = pm.PyNode('neck_C0_fk0_npo')
isolate_attr_holder = pm.PyNode('neckSettings_C0_ctl')
# create extra top group for isolate constrain
pm.select(isolate_constrain_grp, r=True)
isolate_grp = pm.group(n=isolate_constrain_grp.name() + '_isolate', empty=True, world=True)
pm.delete(pm.parentConstraint(isolate_ctrl, isolate_grp, mo=False))
isolate_constrain_grp_parent = isolate_constrain_grp.getParent()
pm.parent(isolate_constrain_grp, isolate_grp)
pm.parent(isolate_grp, isolate_constrain_grp_parent)
# add orientConstraint
con = pm.parentConstraint(global_ctrl, parent_ctrl, isolate_grp, mo=True, weight=0, skipTranslate=['x', 'y', 'z'])
con.interpType.set(2)
# add attribute for switching spaces
pm.addAttr(isolate_attr_holder, type='float', min=0, max=1, dv=0, longName='isolate_rotation', keyable=True)
# connect attr to constraint target weights
isolate_attr_holder.isolate_rotation >> con.getWeightAliasList()[0]
rev_node = pm.createNode('reverse')
isolate_attr_holder.isolate_rotation >> rev_node.inputX
rev_node.outputX >> con.getWeightAliasList()[1]