code: def download_playlist(playlist):
      
      global arguments
      invalid_chars = '\/:*?|<>"'
      playlist_name = playlist['title'].encode('utf-8', 'ignore')
      playlist_name = playlist_name.decode('utf8')
      playlist_name = ''.join(c for c in playlist_name if c not in invalid_chars)
  
      if not arguments['--no-playlist-folder']:
          if not os.path.exists(playlist_name):
              os.makedirs(playlist_name)
          os.chdir(playlist_name)
  
      try:
          with codecs.open(playlist_name + '.m3u', 'w+', 'utf8') as playlist_file:
              playlist_file.write('#EXTM3U' + os.linesep)
              del playlist['tracks'][:offset - 1]
              for counter, track_raw in enumerate(playlist['tracks'], offset):
                  logger.debug(track_raw)
                  logger.info('Track n°{0}'.format(counter))
                  download_track(track_raw, playlist['title'], playlist_file)
      finally:
          os.chdir('..')
docs: Downloads a playlist