def METHOD_NAME(self):
    METHOD_NAME = self.get_related('cancel')
    if not METHOD_NAME.can_cancel:
        return
    try:
        METHOD_NAME.post()
    except exc.MethodNotAllowed as e:
        # Race condition where job finishes between can_cancel
        # check and post.
        if not any("not allowed" in field for field in e.msg.values()):
            raise (e)
    return self.get()