#NEWLINE# def get_or_create_spotify_playlist( self , username , playlist_name ) : #NEWLINE# #INDENT# playlists = spotify . user_playlists ( username ) #NEWLINE# while playlists : #NEWLINE# #INDENT# for item in playlists [ 'items' ] : #NEWLINE# #INDENT# if ( item [ 'name' ] == playlist_name ) : #NEWLINE# #INDENT# return item [ 'id' ] #NEWLINE# #UNINDENT# #UNINDENT# playlists = spotify . next ( playlists ) #NEWLINE# #UNINDENT# playlist = spotify . user_playlist_create ( username , playlist_name ) #NEWLINE# playlist_id = playlist [ 'uri' ] #NEWLINE# return playlist_id