<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pnl_cancel(self, asset_manager_id, pnl_type, business_date, book_id, next_hash_key=None, next_range_key=None, page_size=None):
 """ Cancel the PNL records matching the request Args: asset_manager_id (int):
 id of asset manager owning the pnl records pnl_type (str):
 either "Position" or "Transaction business_date (date):
 date of the pnl records to return book_id (str):
 book id filter on pnl records next_hash_key (str):
 continuation hash key for paging the results next_range_key (str):
 continuation range key for paging the results page_size (int):
 the number of results to return """

        self.logger.info('Cancelling %s Pnls - Asset Manager: %s - Business Date: %s - Book: %s' % \
                        (pnl_type, asset_manager_id, business_date, book_id))
        url = '%s/pnls/%s' % (self.endpoint, asset_manager_id)
        params = {'pnl_type': pnl_type,
                  'business_date': business_date.isoformat(),
                  'book_id': book_id}

        if next_hash_key:
            params['next_hash_key'] = next_hash_key
        if next_range_key:
            params['next_range_key'] = next_range_key
        if page_size:
            params['page_size'] = page_size

        response = self.session.delete(url, params=params)
        if response.ok:
            json_body = response.json()
            next_hash_key = json_body.get('next_hash_key')
            next_range_key = json_body.get('next_range_key')
            count = json_body.get('count')
            self.logger.info('Cancelled %s Pnl records.', count)
            return next_hash_key, next_range_key, count
        else:
            self.logger.error(response.text)
            response.raise_for_status()