<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, project, job, signal=None):
 """ Cancels a job from a specific project. First class, maps to Scrapyd's cancel job endpoint. """

        url = self._build_url(constants.CANCEL_ENDPOINT)
        data = {
            'project': project,
            'job': job,
        }
        if signal is not None:
            data['signal'] = signal
        json = self.client.post(url, data=data, timeout=self.timeout)
        return json['prevstate']