<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _call_api(self, url, method='GET', params=None, data=None):
 """ Method used to call the API. It returns the raw JSON returned by the API or raises an exception if something goes wrong. :arg url: the URL to call :kwarg method: the HTTP method to use when calling the specified Defaults to GET :kwarg params: the params to specify to a GET request :kwarg data: the data to send to a POST request """


        req = self.session.request(
            method=method,
            url=url,
            params=params,
            headers=self.header,
            data=data,
            verify=not self.insecure,
        )

        output = None
        try:
            output = req.json()
        except Exception as err:
            LOG.debug(req.text)
            # TODO: use a dedicated error class
            raise Exception('Error while decoding JSON: {0}'.format(err))

        if req.status_code != 200:
            LOG.error(output)
            if 'error_code' in output:
                raise APIError(output['error'])
        return output