def query(self, query):
        '''Perform a real DataProvider query.'''
        res = None
        if query.type == 'artist':
            try:  # query by mbid
                if query.mbid_artist:
                    res = self.query_by_mbid(query.type, query.mbid_artist)
            except NotImplementedError:
                pass
            if not res:
                res = self.query_artist(query.artist)
        elif query.type == 'album':
            try:  # query by mbid
                if query.mbid_relgrp:
                    res = self.query_by_mbid(query.type, query.mbid_relgrp)
                if not res and query.mbid_album:
                    res = self.query_by_mbid(query.type, query.mbid_album)
            except __HOLE__:
                pass
            if not res:
                res = self.query_album(query.album, query.artist,
                                       query.year, query.releasetype)
        # preprocess tags
        for result in res or []:
            result['tags'] = self._preprocess_tags(result['tags'])
        return res
dataset/ETHPy150Open YetAnotherNerd/whatlastgenre/wlg/dataprovider.py/DataProvider.query