This command will reroot a skeleton. The selected joint or the given joint at the command line will be the new root of the skeleton. All ikHandles passing through the selected joint or above it will be deleted. The given(or selected) joint should not have skin attached. The command works on the given or selected joint. No options or flags are necessary.
Derived from mel command maya.cmds.reroot
import pymel.core as pm # joint5 will be a new root joint of the skeleton. pm.reroot( 'joint5' )