Update custom hook for python mode.