code: def _end(self, end_message):
          
          action_type = end_message.contents.get(ACTION_TYPE_FIELD, None)
          if self.action_type not in (None, action_type):
              raise WrongActionType(self, end_message)
          self._validate_message(end_message)
          status = end_message.contents.get(ACTION_STATUS_FIELD, None)
          if status not in (FAILED_STATUS, SUCCEEDED_STATUS):
              raise InvalidStatus(self, end_message)
          return self.set(end_message=end_message)
docs: End this action with C{end_message}.
  
          Assumes that the action has not already been ended.
  
          @param WrittenMessage end_message: An end message that has the
              same level as this action.
  
          @raise WrongTask: If C{end_message} has a C{task_uuid} that differs
              from the action's C{task_uuid}.
          @raise WrongTaskLevel: If C{end_message} has a C{task_level} that means
              it's not a direct child.
          @raise InvalidStatus: If C{end_message} doesn't have an
              C{action_status}, or has one that is not C{SUCCEEDED_STATUS} or
              C{FAILED_STATUS}.
  
          @return: A new, completed C{WrittenAction}.