<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cancel(self, job_id):
 """ Cancels a job :param job_id: The id of the job to be cancelled :type job_id: str :return: A status code depending on whether the cancel request was successful :rtype: str :raise CartoException: """

        try:
            confirmation = self.send(self.api_url + job_id, http_method="DELETE")
        except CartoException as e:
            if 'Cannot set status from done to cancelled' in e.args[0].args[0]:
                return 'done'
            else:
                raise e
        return confirmation['status']