handle different cursors for SQLAlchemy 0.5.* and 0.9.6

@ticoann @hufnagel : Would you please review the PR? Please let @geneguvo  know when you have a new tag for this PR so the HTTP group can deploy on slc6?
OK. It is a good practice to use namespace although the possibility to be conflict with the build-ins as MethodType or IntType is small.