Fix some typos and inaccuracies in the documentation
PEP8/coding style

"Comparisons to singletons like None should always be done with is or is not, never the equality operators."
while 1 -> while True
Use iterator.next() in retrieve_attributes

This avoids building a list we never need