Fix for SQLAlchemy

Fixes serialization for SQLAlchemy's KeyedTuple, and other types that look like dicts but don't respond to obj["key"].