use isinstance() instead of comparing types