This is a fix to check  the argument to RequestHandler.write()
is one of the accepted types: dict, bytes or unicode and raise a TypeError otherwise