py3: Consistently use os.walk instead of os.path.walk.

os.path.walk is deprecated, and removed in Python 3. This requires a
minor behavioural change.
See: https://bugs.python.org/issue4601
py3: Always use cStringIO to import StringIO

StringIO.StringIO is obsolete.
When we'll move things fully towards Python 3 we might have to deal with
io.BytesIO instead of io.StringIO.