<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, href=None, query=None, query_fields=None, query_filter=None, limit=None, embed_items=None, embed_tracks=None, embed_metadata=None, embed_insights=None, language=None):
 """Search a media collection. 'href' the relative href to the bundle list to retriev. If None, the first bundle list will be returned. 'query' See API docs for full description. May not be None if href is None. 'query_fields' See API docs for full description. May be None. Ignored if href is not None. 'query_filter' See API docs for full description. May be None. Ignored if href is not None. 'limit' the maximum number of bundles to include in the result. 'embed_items' whether or not to expand the bundle data into the result. 'embed_tracks' whether or not to expand the bundle track data into the result. 'embed_metadata' whether or not to expand the bundle metadata into the result. 'embed_insights' whether or not to expand the bundle insights into the result. 'language' the 2 letter language code of the language to search in. Ignored if href is not None. NB: providing values for 'limit', 'embed_*' will override either the API default or the values in the provided href. Returns a data structure equivalent to the JSON returned by the API. If the response status is not 2xx, throws an APIException. If the JSON to python data struct conversion fails, throws an APIDataException."""


        # Argument error checking.
        assert query is not None
        assert limit is None or limit > 0

        if href is None:
            j = self._search_p1(query, query_fields, query_filter, limit,
                                embed_items, embed_tracks, embed_metadata,
                                embed_insights, language)

        else:
            j = self._search_pn(href, limit, embed_items, embed_tracks,
                                embed_insights, embed_metadata)

        # Convert the JSON to a python data struct.

        return self._parse_json(j)