Use collections.Mapping/Sequence in isinstance checks

This should at least be a little more portable than checking for
dict/list directly.