<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cancelPendingResult( self, jobid ):
 """Cancel a particular pending result. Note that this only affects the notebook's record, not any job running in a lab. :param jobid: job id for pending result"""

        if jobid in self._pending.keys():
            k = self._pending[jobid]
            del self._pending[jobid]
            if k in self._results.keys():
                rs = self._results[k]
                j = rs.index(jobid)
                del rs[j]
            else:
                # we've screwed-up the internal data structures
                raise RuntimeError('Internal structure error for {j} -> {ps}'.format(j = jobid,
                                                                                     ps = k))
        else:
            # no such job
            # sd: should this just fail silently?
            raise KeyError('No pending result with id {j}'.format(j = jobid))