def fetch_tracks(user, page, limit):
 network = pylast.LastFMNetwork(api_key=config['lastfm']['api_key'])
 user_obj = CustomUser(user, network)
 (results, total_pages) = user_obj.get_top_tracks_by_page(limit=limit, page=page)
 return ([{'mbid': (track.item.mbid if track.item.mbid else ''), 'artist': {'name': track.item.artist.name}, 'name': track.item.title, 'playcount': track.weight} for track in results], total_pages)

def fetch_tracks ( user , page , limit ) : network = pylast . LastFMNetwork ( api_key = config [ 'lastfm' ] [ 'api_key' ] ) user_obj = CustomUser ( user , network ) ( results , total_pages ) = user_obj . get_top_tracks_by_page ( limit = limit , page = page ) return ( [ { 'mbid' : ( track . item . mbid if track . item . mbid else '' ) , 'artist' : { 'name' : track . item . artist . name } , 'name' : track . item . title , 'playcount' : track . weight } for track in results ] , total_pages )
json format: "mbid": " .