BytesIO, some other Phoenix compatibility stuff

Sorry, contains some whitespace changes, but AUI_DockingWindowMgr from some time ago.