Fix python2 compatability: Using string_types instead of str for isinstance