Use isinstance() rather than a check using type()