def _process_body(self, body): """ Process the request body, ensuring the proper encoding. @param body: request body to process @return: properly encoded request body """ if isinstance(body, (list, set, tuple)): return [self._process_body(b) for b in body] elif isinstance(body, dict): return dict((self._process_body(k), self._process_body(v)) for k, v in body.items()) return ensure_utf_8(body)