Optimize `PyMapping` conversion for `dict` inputs.