use portable basestring type for isinstance's
documentation, fixed bad var in error message