def user_artists(request, username):
    
    uh = UserHistory(username)
    uh.load_if_possible()
    
    artists = [(sum(weeks.values()), artist) for artist, weeks in uh.artists.items()]
    artists.sort()
    artists.reverse()
    
    try:
        max_plays = float(artists[0][0])
    except __HOLE__:
        max_plays = 1000
    
    artists = [(plays, artist, 100*plays/max_plays) for plays, artist in artists]
    
    return render(request, "user_artists.html", {"username": username, "artists": artists})
dataset/ETHPy150Open andrewgodwin/lastgraph/lastgui/views.py/user_artists