I know that you didn't modify this `isinstance` check, but does it really need to be there? Duck-typing is generally the Python way.