Use of isinstance() is idiomatic, and comparing the result of type() will not match subclasses.
isinstance()
type()