docs: def _validate_post_body(actual_request_body, body_specification):
      """ returns a tuple (boolean, msg)
          to indicate whether the validation passed
          if False then msg contains the reason
          if True then msg is empty
      """
  
      # If no body specified, return True (POST with empty body is allowed):
      if "body" not in body_specification["parameters"]:
          return True, ""
  
      # Are there required parameters? - there is only ONE body, so we check that one
      parameters_required = body_specification['parameters']['body']['required']
  
      # What if it says 'required' but there is no schema ? - we reject it
      schema_present = body_specification['parameters']['body'].get('schema')
      if parameters_required and not schema_present:
          msg = "there is no schema given, but it says there are required parameters"
          return False, msg
  
      # What is the mime type ?
      text_is_accepted = any('text' in item for item in body_specification.get('consumes', []))
      json_is_accepted = any('json' in item for item in body_specification.get('consumes', []))
  
      if actual_request_body is '' and not text_is_accepted:
          msg = "post body is an empty string, but text is not an accepted mime type"
          return False, msg
  
      if actual_request_body == {} and not json_is_accepted:
          msg = "post body is an empty dict, but json is not an accepted mime type"
          return False, msg
  
      # If only json is accepted, but the body is a string, we transform the
      # string to json and check it then (not sure if the server would accept
      # that string, though)
      if (json_is_accepted and not
              text_is_accepted and
              type(actual_request_body).__name__ == 'str'):
          actual_request_body = json.loads(actual_request_body)
  
      # Handle empty body
      body_is_empty = actual_request_body in [None, '', {}]
      if body_is_empty:
          if parameters_required:
              msg = "there is no body, but it says there are required parameters"
              return False, msg
          else:
              return True, ""
  
      return True, ""