<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download(self, directory='~/Music', song_name='%a - %s - %A'):
 """ Download a song to a directory. :param directory: A system file path. :param song_name: A name that will be formatted with :meth:`format`. :return: The formatted song name. """

        formatted = self.format(song_name)
        path = os.path.expanduser(directory) + os.path.sep + formatted + '.mp3'
        try:
            raw = self.safe_download()
            with open(path, 'wb') as f:
                f.write(raw)
        except:
            raise
        return formatted