A string scanner class for Python