PYTHON-505 Allow C extensions to encode any mapping type, not just dicts.