Speed up python document