`isinstance` isn't very Pythonic -- it's better to use duck-typing when possible. Is it possible in this case? It may not be, and if that's the case then that's fine -- but if you can clean this up and avoid all these `isinstance` checks, so much the better.