docs: def _check_result(method_name, result):
      """
      Checks whether `result` is a valid API response.
      A result is considered invalid if:
          - The server returned an HTTP response code other than 200
          - The content of the result is invalid JSON.
          - The method call was unsuccessful (The JSON 'ok' field equals False)
  
      :raises ApiException: if one of the above listed cases is applicable
      :param method_name: The name of the method called
      :param result: The returned result of the method request
      :return: The result parsed to a JSON dictionary.
      """
      if result.status_code != 200:
          msg = 'The server returned HTTP {0} {1}. Response body:\n[{2}]' \
              .format(result.status_code, result.reason, result.text.encode('utf8'))
          raise ApiException(msg, method_name, result)
  
      try:
          result_json = result.json()
      except:
          msg = 'The server returned an invalid JSON response. Response body:\n[{0}]' \
              .format(result.text.encode('utf8'))
          raise ApiException(msg, method_name, result)
  
      if not result_json['ok']:
          msg = 'Error code: {0} Description: {1}' \
              .format(result_json['error_code'], result_json['description'])
          raise ApiException(msg, method_name, result)
      return result_json