<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_media(self, mediafile, play_audio=True):
 		""" Loads a media file to decode. 		If an audiostream is detected, its parameters will be stored in a 		dictionary in the variable `audioformat`. This contains the fields 		:nbytes: the number of bytes in the stream (2 is 16-bit sound). 		:nchannels: the channels (2 for stereo, 1 for mono) 		:fps: the frames per sec/sampling rate of the sound (e.g. 44100 KhZ). 		:buffersize: the audioframes per buffer. 		 		If play_audio was set to False, or the video does not have an audiotrack, 		`audioformat` will be None. 		Parameters 		mediafile : str 			The path to the media file to load. 		play_audio : bool, optional 			Indicates whether the audio of a movie should be played. 		Raises 		------ 		IOError 			When the file could not be found or loaded. 		"""

		if not mediafile is None:
			if os.path.isfile(mediafile):
				self.clip = VideoFileClip(mediafile, audio=play_audio)

				self.loaded_file = os.path.split(mediafile)[1]

				## Timing variables
				# Clip duration
				self.duration = self.clip.duration
				self.clock.max_duration = self.clip.duration
				logger.debug("Video clip duration: {}s".format(self.duration))

				# Frames per second of clip
				self.fps = self.clip.fps
				self.clock.fps = self.clip.fps
				logger.debug("Video clip FPS: {}".format(self.fps))

				if play_audio and self.clip.audio:
					buffersize = int(self.frame_interval*self.clip.audio.fps)
					self.audioformat = {
						'nbytes':  	  	2,
						'nchannels':	self.clip.audio.nchannels,
						'fps':	 	  	self.clip.audio.fps,
						'buffersize':	buffersize
					}
					logger.debug("Audio loaded: \n{}".format(self.audioformat))
					logger.debug("Creating audio buffer of length: "
						" {}".format(queue_length))
					self.audioqueue = Queue(queue_length)
				else:
					self.audioformat = None

				logger.debug('Loaded {0}'.format(mediafile))
				self.status = READY
				return True
			else:
				raise IOError("File not found: {0}".format(mediafile))
		return False