<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def search(self, query, type=SONGS):
        '''
        Search for songs, artists and albums.

        :param query: search string
        :param type: type to search for
        :rtype: a generator generates :class:`Song`, :class:`Artist` and :class:`Album` objects

        Search Types:

        +---------------------------------+---------------------------------+
        | Constant                        | Meaning                         |
        +=================================+=================================+
        | :const:`Client.SONGS`           | Search for songs                |
        +---------------------------------+---------------------------------+
        | :const:`Client.ARTISTS`         | Search for artists              |
        +---------------------------------+---------------------------------+
        | :const:`Client.ALBUMS`          | Search for albums               |
        +---------------------------------+---------------------------------+
        | :const:`Client.PLAYLISTS`       | Search for playlists            |
        +---------------------------------+---------------------------------+
        '''
        result = self.connection.request(
            'getResultsFromSearch',
            {'query': query, 'type': type, 'guts': 0, 'ppOverride': False},
            self.connection.header('getResultsFromSearch'))[1]['result']
        if type == self.SONGS:
            return (Song.from_response(song, self.connection)
                    for song in result)
        elif type == self.ARTISTS:
            return (Artist(artist['ArtistID'], artist['Name'], self.connection)
                    for artist in result)
        elif type == self.ALBUMS:
            return (self._parse_album(album) for album in result)
        elif type == self.PLAYLISTS:
            return (self._parse_playlist(playlist) for playlist in result)