Instruction:
Write a Python 3 function for
returning the pk of the object.

Response:
def getPk(self):
		'''
			getPk - Resolve any absent pk's off the obj's (like if an obj has been saved), and return the pk.
		'''
		if not self.pk and self.obj:
			if self.obj._id:
				self.pk = self.obj._id

		return self.pk


Instruction:
How would you implement a function in Python 3 that
returns True if any object has unsaved changes.

Response:
def objHasUnsavedChanges(self):
		'''
			objHasUnsavedChanges - Check if any object has unsaved changes, cascading.
		'''
		if not self.obj:
			return False

		return self.obj.hasUnsavedChanges(cascadeObjects=True)


Instruction:
Create a Python 3 function for
getting PK - @see ForeignLinkData. getPk - @see ForeignLinkData. getPk

Response:
def getPk(self):
		'''
			getPk - @see ForeignLinkData.getPk
		'''
		if not self.pk or None in self.pk:
			for i in range( len(self.pk) ):
				if self.pk[i]:
					continue

				if self.obj[i] and self.obj[i]._id:
					self.pk[i] = self.obj[i]._id

		return self.pk


Instruction:
Write a Python 3 script for
returning True if the object is fetched.

Response:
def isFetched(self):
		'''
			isFetched - @see ForeignLinkData.isFetched
		'''
		if not self.obj:
			return False

		if not self.pk or None in self.obj:
			return False
		return not bool(self.obj is None)


Instruction:
Explain what the following Python 3 code does
def objHasUnsavedChanges(self):
		'''
			objHasUnsavedChanges - @see ForeignLinkData.objHasUnsavedChanges

			True if ANY object has unsaved changes.
		'''
		if not self.obj:
			return False

		for thisObj in self.obj:
			if not thisObj:
				continue
			if thisObj.hasUnsavedChanges(cascadeObjects=True):
				return True

		return False

Response: Returns True if any of the objects in the object has unsaved changes.