`isinstance(dja[key], basestring)` is the more-usual way to write this.