code: def _handle_error(self, result, err_msg):
          
          if result.get(u'error'):
              raise RequestError("{}\nResponse: {}".format(
                  err_msg,
                  json.dumps(result, indent=2)
              ))
          else:
              return result.get(u'result')
docs: Check result for error
  
          :type result: dict
          :param result: response body
          :type err_msg: str
          :param err_msg: The message given to the :class:`RequestError` instance
              raised
          :returns: Actual result from result
          :raises RequestError: If result has error