<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_mongo(cls, doc):
 		"""Convert data coming in from the MongoDB wire driver into a Document instance."""

		
		if doc is None:  # To support simplified iterative use, None should return None.
			return None
		
		if isinstance(doc, Document):  # No need to perform processing on existing Document instances.
			return doc
		
		if cls.__type_store__ and cls.__type_store__ in doc:  # Instantiate specific class mentioned in the data.
			cls = load(doc[cls.__type_store__], 'marrow.mongo.document')
		
		# Prepare a new instance in such a way that changes to the instance will be reflected in the originating doc.
		instance = cls(_prepare_defaults=False)  # Construct an instance, but delay default value processing.
		instance.__data__ = doc  # I am Popeye of Borg (pattern); you will be askimilgrated.
		instance._prepare_defaults()  # pylint:disable=protected-access -- deferred default value processing.
		
		return instance