def search(self, title=None, sort=None, maxresults=<NUM_LIT>, libtype=None, **kwargs):
<EOL>args = {}<EOL>for category, value in kwargs.items():<EOL><INDENT>args[category] = self._cleanSearchFilter(category, value, libtype)<EOL><DEDENT>if title is not None:<EOL><INDENT>args['<STR_LIT:title>'] = title<EOL><DEDENT>if sort is not None:<EOL><INDENT>args['<STR_LIT>'] = self._cleanSearchSort(sort)<EOL><DEDENT>if libtype is not None:<EOL><INDENT>args['<STR_LIT:type>'] = utils.searchType(libtype)<EOL><DEDENT>results, subresults = [], '<STR_LIT>'<EOL>args['<STR_LIT>'] = <NUM_LIT:0><EOL>args['<STR_LIT>'] = min(X_PLEX_CONTAINER_SIZE, maxresults)<EOL>while subresults and maxresults > len(results):<EOL><INDENT>key = '<STR_LIT>' % (self.key, utils.joinArgs(args))<EOL>subresults = self.fetchItems(key)<EOL>results += subresults[:maxresults - len(results)]<EOL>args['<STR_LIT>'] += args['<STR_LIT>']<EOL><DEDENT>return results<EOL>
Search the library. If there are many results, they will be fetched from the server
            in batches of X_PLEX_CONTAINER_SIZE amounts. If you're only looking for the first <num>
            results, it would be wise to set the maxresults option to that amount so this functions
            doesn't iterate over all results on the server.

            Parameters:
                title (str): General string query to search for (optional).
                sort (str): column:dir; column can be any of {addedAt, originallyAvailableAt, lastViewedAt,
                      titleSort, rating, mediaHeight, duration}. dir can be asc or desc (optional).
                maxresults (int): Only return the specified number of results (optional).
                libtype (str): Filter results to a spcifiec libtype (movie, show, episode, artist,
                    album, track; optional).
                **kwargs (dict): Any of the available filters for the current library section. Partial string
                        matches allowed. Multiple matches OR together. Negative filtering also possible, just add an
                        exclamation mark to the end of filter name, e.g. `resolution!=1x1`.

                        * unwatched: Display or hide unwatched content (True, False). [all]
                        * duplicate: Display or hide duplicate items (True, False). [movie]
                        * actor: List of actors to search ([actor_or_id, ...]). [movie]
                        * collection: List of collections to search within ([collection_or_id, ...]). [all]
                        * contentRating: List of content ratings to search within ([rating_or_key, ...]). [movie,tv]
                        * country: List of countries to search within ([country_or_key, ...]). [movie,music]
                        * decade: List of decades to search within ([yyy0, ...]). [movie]
                        * director: List of directors to search ([director_or_id, ...]). [movie]
                        * genre: List Genres to search within ([genere_or_id, ...]). [all]
                        * network: List of TV networks to search within ([resolution_or_key, ...]). [tv]
                        * resolution: List of video resolutions to search within ([resolution_or_key, ...]). [movie]
                        * studio: List of studios to search within ([studio_or_key, ...]). [music]
                        * year: List of years to search within ([yyyy, ...]). [all]

            Raises:
                :class:`plexapi.exceptions.BadRequest`: when applying unknown filter