<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def previous(self):
 		""" Moves the 'Cursor' to & returns the previous 'Node'. Raises 			'GameTreeEndError' if the start of a branch is exceeded."""

		if self.index - 1 >= 0:					# more main line?
			self.index = self.index - 1
		elif self.stack:						# were we in a variation?
			self.gametree = self.stack.pop()
			self.index = len(self.gametree) - 1
		else:
			raise GameTreeEndError
		self.node = self.gametree[self.index]
		self.nodenum = self.nodenum - 1
		self._setChildren()
		self._setFlags()
		return self.node