make handler Py3 compatible

I've used some code from six to make handler working OK with Py3 + extra fields.

Currently when we log something with extra fields, it crash because `basestring` is not part of Python 3.