Fix return value and improve API to suite pyqode.python requirements