def lastfm_get_tree(self, method, **kwargs):
        kwargs.update({
            'autocorrect': 1,
            self.get_type(): unicode(self).encode('utf-8'),
        })

        if hasattr(self, 'artist'):
            kwargs['artist'] = unicode(self.artist).encode('utf-8')
        if hasattr(self, 'album'):
            kwargs['album'] = unicode(self.album).encode('utf-8')

        url = 'http://ws.audioscrobbler.com/2.0/?api_key=%s&method=%s&%s' % (
            settings.LASTFM_API_KEY,
            method,
            urllib.urlencode(kwargs)
        )

        logger.info(url)

        try:
            tree = etree.parse(url)
            return tree
        except __HOLE__:
            print "Did not work: "+url
            return None
dataset/ETHPy150Open jpic/playlistnow.fm/apps/music/models.py/MusicalEntity.lastfm_get_tree