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
Example:
import pymel.core as pm
import maya.cmds as cmds
# joint5 will be a new root joint of the skeleton.
pm.reroot( 'joint5' )