<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _req(self, path, method='get', json=True, assert_status=200, **kw):
 """Make a request to the API of an cdstar instance. :param path: HTTP path. :param method: HTTP method. :param json: Flag signalling whether the response should be treated as JSON. :param assert_status: Expected HTTP response status of a successful request. :param kw: Additional keyword parameters will be handed through to the \ appropriate function of the requests library. :return: The return value of the function of the requests library or a decoded \ JSON object/array. """

        method = getattr(self.session, method.lower())
        res = method(self.url(path), **kw)

        status_code = res.status_code
        if json:
            try:
                res = res.json()
            except ValueError:
                log.error(res.text[:1000])
                raise
        if assert_status:
            if not isinstance(assert_status, (list, tuple)):
                assert_status = [assert_status]
            if status_code not in assert_status:
                log.error(
                    'got HTTP %s, expected HTTP %s' % (status_code, assert_status))
                log.error(res.text[:1000] if hasattr(res, 'text') else res)
                raise CdstarError('Unexpected HTTP status code', res, status_code)
        return res