RF: use simpler use of "isinstance" as suggested by @yaroptic