def delete(self, monitor_id):
if not self._state:<EOL><INDENT>raise InvalidState("<STR_LIT>")<EOL><DEDENT>monitors = self.list()  <EOL>bit = None<EOL>for monitor in monitors:<EOL><INDENT>if monitor_id != monitor['<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>bit = monitor['<STR_LIT>']<EOL><DEDENT>if not bit:<EOL><INDENT>raise MonitorNotFound("<STR_LIT>")<EOL><DEDENT>url = self.ALERTS_DELETE_URL.format(requestX=self._state[<NUM_LIT:3>])<EOL>self._log.debug("<STR_LIT>" % url)<EOL>payload = [None, monitor_id]<EOL>params = json.dumps(payload, separators=('<STR_LIT:U+002C>', '<STR_LIT::>'))<EOL>data = {'<STR_LIT>': params}<EOL>response = self._session.post(url, data=data, headers=self.HEADERS)<EOL>if response.status_code != <NUM_LIT:200>:<EOL><INDENT>raise ActionError("<STR_LIT>"<EOL>% response.content)<EOL><DEDENT>return True<EOL>
Delete a monitor by ID.