Validation part fix. Fixes #5322

I added adittional function, which can be reused somewhere else also.
I grepped and it is much more places where isinstance(temp, str) is called.
So it must be fixed also on all other places.
This part is enough for crabserver, will check later sitedb.

As previuosly I said to change it to basestring, it did not worked, when I was submitting/quering status. I am using current production crabserver code, and wmcore code. Please feel free to comment, suggest, blame ;)

@geneguvo @mmascher @ericvaandering @amaltaro @bbockelm