Override RequestHandler.write to also serialize lists
Add method for writing of error messages

This will allow you to call self.write_error() with an object that has
error_message and error_code attributes.