docs: def upload(
  		self,
  		song,
  		*,
  		album_art_path=None,
  		no_sample=False
  	):
  		"""Upload a song to a Google Music library.
  
  		Parameters:
  			song (os.PathLike or str or audio_metadata.Format):
  				The path to an audio file or an instance of :class:`audio_metadata.Format`.
  			album_art_path (os.PathLike or str, Optional):
  				The relative filename or absolute filepath to external album art.
  			no_sample(bool, Optional):
  				Don't generate an audio sample from song;
  				send empty audio sample.
  				Default: Create an audio sample using ffmpeg/avconv.
  
  		Returns:
  			dict: A result dict with keys: ``'filepath'``, ``'success'``, ``'reason'``, and ``'song_id'`` (if successful).
  		"""
  
  		if not isinstance(song, audio_metadata.Format):
  			try:
  				song = audio_metadata.load(song)
  			except audio_metadata.UnsupportedFormat:
  				raise ValueError("'song' must be FLAC, MP3, or WAV.")
  
  		if album_art_path:
  			album_art_path = Path(album_art_path).resolve()
  
  			if album_art_path.is_file():
  				with album_art_path.open('rb') as image_file:
  					external_art = image_file.read()
  			else:
  				external_art = None
  		else:
  			external_art = None
  
  		result = {'filepath': Path(song.filepath)}
  
  		track_info = mm_calls.Metadata.get_track_info(song)
  		response = self._call(
  			mm_calls.Metadata,
  			self.uploader_id,
  			[track_info]
  		)
  
  		metadata_response = response.body.metadata_response
  
  		if metadata_response.signed_challenge_info:  # Sample requested.
  			sample_request = metadata_response.signed_challenge_info[0]
  
  			try:
  				track_sample = mm_calls.Sample.generate_sample(
  					song,
  					track_info,
  					sample_request,
  					external_art=external_art,
  					no_sample=no_sample
  				)
  				response = self._call(
  					mm_calls.Sample,
  					self.uploader_id,
  					[track_sample]
  				)
  				track_sample_response = response.body.sample_response.track_sample_response[0]
  			except (OSError, ValueError, subprocess.CalledProcessError):
  				raise  # TODO
  		else:
  			track_sample_response = metadata_response.track_sample_response[0]
  
  		response_code = track_sample_response.response_code
  
  		if response_code == upload_pb2.TrackSampleResponse.MATCHED:
  			result.update(
  				{
  					'success': True,
  					'reason': 'Matched',
  					'song_id': track_sample_response.server_track_id
  				}
  			)
  		elif response_code == upload_pb2.TrackSampleResponse.UPLOAD_REQUESTED:
  			server_track_id = track_sample_response.server_track_id
  
  			self._call(
  				mm_calls.UploadState,
  				self.uploader_id,
  				'START'
  			)
  
  			attempts = 0
  			should_retry = True
  
  			while should_retry and attempts <= 10:
  				# Call with tenacity.retry_with to disable automatic retries.
  				response = self._call.retry_with(stop=stop_after_attempt(1))(
  					self,
  					mm_calls.ScottyAgentPost,
  					self.uploader_id,
  					server_track_id,
  					track_info,
  					song,
  					external_art=external_art,
  					total_song_count=1,
  					total_uploaded_count=0
  				)
  
  				session_response = response.body
  
  				if 'sessionStatus' in session_response:
  					break
  
  				try:
  					# WHY, GOOGLE?! WHY???????????
  					status_code = session_response['errorMessage']['additionalInfo'][
  						'uploader_service.GoogleRupioAdditionalInfo'
  					]['completionInfo']['customerSpecificInfo'][
  						'ResponseCode'
  					]
  				except KeyError:
  					status_code = None
  
  				if status_code == 503:  # Upload server still syncing.
  					should_retry = True
  					reason = "Server syncing"
  				elif status_code == 200:  # Song is already uploaded.
  					should_retry = False
  					reason = "Already uploaded"
  				elif status_code == 404:  # Rejected.
  					should_retry = False
  					reason = "Rejected"
  				else:
  					should_retry = True
  					reason = "Unkown error"
  
  				attempts += 1
  
  				time.sleep(2)  # Give the server time to sync.
  			else:
  				result.update(
  					{
  						'success': False,
  						'reason': f'Could not get upload session: {reason}'
  					}
  				)
  
  			if 'success' not in result:
  				transfer = session_response['sessionStatus']['externalFieldTransfers'][0]
  
  				upload_url = transfer['putInfo']['url']
  				content_type = transfer.get('content_type', 'audio/mpeg')
  				original_content_type = track_info.original_content_type
  
  				transcode = (
  					isinstance(song, audio_metadata.WAV)
  					or original_content_type != locker_pb2.Track.MP3
  				)
  
  				if (
  					transcode
  					or original_content_type == locker_pb2.Track.MP3
  				):
  					if transcode:
  						audio_file = transcode_to_mp3(song, quality='320k')
  					else:
  						with open(song.filepath, 'rb') as f:
  							audio_file = f.read()
  
  					# Google Music allows a maximum file size of 300 MiB.
  					if len(audio_file) >= 300 * 1024 * 1024:
  						result.update(
  							{
  								'success': False,
  								'reason': 'Maximum allowed file size is 300 MiB.'
  							}
  						)
  					else:
  						upload_response = self._call(
  							mm_calls.ScottyAgentPut,
  							upload_url,
  							audio_file,
  							content_type=content_type
  						).body
  
  						if upload_response.get('sessionStatus', {}).get('state'):
  							result.update(
  								{
  									'success': True,
  									'reason': 'Uploaded',
  									'song_id': track_sample_response.server_track_id
  								}
  							)
  						else:
  							result.update(
  								{
  									'success': False,
  									'reason': upload_response  # TODO: Better error details.
  								}
  							)
  				else:
  					# Do not upload files if transcode option set to False.
  					result.update(
  						{
  							'success': False,
  							'reason': 'Transcoding disabled for file type.'
  						}
  					)
  
  				self._call(mm_calls.UploadState, self.uploader_id, 'STOPPED')
  		else:
  			response_codes = upload_pb2._TRACKSAMPLERESPONSE.enum_types[0]
  			response_type = response_codes.values_by_number[
  				track_sample_response.response_code
  			].name
  
  			reason = response_type
  
  			result.update(
  				{
  					'success': False,
  					'reason': f'{reason}'
  				}
  			)
  
  			if response_type == 'ALREADY_EXISTS':
  				result['song_id'] = track_sample_response.server_track_id
  
  		return result