doc updates for api.
refactor _compat for py2 py3k