Use isinstance() insted of type()

- compare to basestring instead of str, this matches unicode too
- fix indentation
1 file changed