docs: def model_to_request_body(body_model, content_type, body_model_root_element=None):
      """
      Convert a Python dict (body model) to XML or JSON
      :param body_model: Model to be parsed. This model should have a root element.
      :param content_type: Target representation (Content-Type header value)
      :param body_model_root_element: For XML requests. XML root element in the model (if exists).
      :return:
      """
  
      logger.info("Converting body request model (Python dict) to JSON or XML")
      if HEADER_REPRESENTATION_XML == content_type:
          try:
              return _dict_to_xml(body_model)
          except Exception, e:
              logger.error("Error parsing the body model to XML. Exception: " + str(e))
              raise e
      else:
          body_json = body_model[body_model_root_element] if body_model_root_element is not None else body_model
          encoder = JSONEncoder()
  
          try:
              return encoder.encode(body_json)
          except Exception, e:
              logger.error("Error parsing the body model to JSON. Exception:" + str(e))
              raise e