old_contents: #!/usr/bin/env python
  
  import rospy
  from apriltags_ros.msg import AprilTagDetectionArray
  import time
  
  class AprilTagModule(object):
  
  
  	def _tagCallback(self, msg):
  
  		for detected in msg.detections:
  			tag_id = detected.id 
  
  			#updated stamped pose
  			self.detected_tags[tag_id] = detected.pose
  
  	def __init__(self):
  		rospy.Subscriber('/tag_detections',AprilTagDetectionArray,self._tagCallback)
  		
  		#save list
  		self.detected_tags = {}
  
  		#not sure if we need to spin here
  
  	def getPoseForID(self, id_):
  		
  		if id_ in self.detected_tags:
  			return self.detected_tags[id_]
  		else:
  			rospy.loginfo("ID never been seen")
  			return None
  
  
  
  def main():
  	rospy.init_node('AprilTagModule_test')
  	tag_module = AprilTagModule()
  
  	r = rospy.Rate(5)
  
  	while True:
  		pose = tag_module.getPoseForID(0)
  		if pose is not None:
  			p = pose.pose
  			print("x:{}, y:{}, z:{}".format(p.position.x, p.position.y, p.position.z))
  		time.sleep(1)
  
  if __name__ == '__main__':
  	main()
  
new_contents: #!/usr/bin/env python
  
  import rospy
  from apriltags_ros.msg import AprilTagDetectionArray
  import time
  
  class AprilTagModule(object):
  	"""Wrapper for AprilTag Node
  	
  	Wrapper for AprilTag Node, provide easy methods to check for april tag items
  
  	"""
  
  	def __init__(self):
  		rospy.Subscriber('/tag_detections',AprilTagDetectionArray,self._tagCallback)
  		
  		#dict that stored all seen tags
  		self.detected_tags = {}
  		
  
  	def _tagCallback(self, msg):
  
  		for detected in msg.detections:
  			tag_id = detected.id 
  
  			#updated stamped pose
  			self.detected_tags[tag_id] = detected.pose
  
  
  	def getPoseForID(self, id_):
  		"""
  		Returns the last stamped pose for the aprilTag with given id if detected. Return none
  		if it never seen tags with that id.
  		
  		Parameters
  		----------
  		id_ : int
  			ID of the tag looking for
  
  		Returns:
  		geomtery/StampedPose
  			StampedPose when the ID was last seen by the April Tag Node
  
  		"""
  		
  		if id_ in self.detected_tags:
  			return self.detected_tags[id_]
  		else:
  			rospy.loginfo("ID never been seen")
  			return None
subject: refactor and added comments