which-function hangs w unbalanced quote marks, lp:1235375, fixed

At the occassion introduced a heuristic exit
`py-max-specpdl-size', default is `max-specpdl-size',

py-end-of-statement will error if number of
`py-max-specpdl-size' loops is completed, thus avoiding
a hang from a possibly eternal loop.