<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def kernels_list(self, page=1, page_size=20, dataset=None, competition=None, parent_kernel=None, search=None, mine=False, user=None, language=None, kernel_type=None, output_type=None, sort_by=None):
 """ list kernels based on a set of search criteria Parameters ========== page: the page of results to return (default is 1) page_size: results per page (default is 20) dataset: if defined, filter to this dataset (default None) competition: if defined, filter to this competition (default None) parent_kernel: if defined, filter to those with specified parent search: a custom search string to pass to the list query mine: if true, group is specified as "my" to return personal kernels user: filter results to a specific user language: the programming language of the kernel kernel_type: the type of kernel, one of valid_kernel_types (str) output_type: the output type, one of valid_output_types (str) sort_by: if defined, sort results by this string (valid_sort_by) """

        if int(page) <= 0:
            raise ValueError('Page number must be >= 1')

        page_size = int(page_size)
        if page_size <= 0:
            raise ValueError('Page size must be >= 1')
        if page_size > 100:
            page_size = 100

        valid_languages = ['all', 'python', 'r', 'sqlite', 'julia']
        if language and language not in valid_languages:
            raise ValueError('Invalid language specified. Valid options are ' +
                             str(valid_languages))

        valid_kernel_types = ['all', 'script', 'notebook']
        if kernel_type and kernel_type not in valid_kernel_types:
            raise ValueError(
                'Invalid kernel type specified. Valid options are ' +
                str(valid_kernel_types))

        valid_output_types = ['all', 'visualization', 'data']
        if output_type and output_type not in valid_output_types:
            raise ValueError(
                'Invalid output type specified. Valid options are ' +
                str(valid_output_types))

        valid_sort_by = [
            'hotness', 'commentCount', 'dateCreated', 'dateRun', 'relevance',
            'scoreAscending', 'scoreDescending', 'viewCount', 'voteCount'
        ]
        if sort_by and sort_by not in valid_sort_by:
            raise ValueError(
                'Invalid sort by type specified. Valid options are ' +
                str(valid_sort_by))
        if sort_by == 'relevance' and search == '':
            raise ValueError('Cannot sort by relevance without a search term.')

        self.validate_dataset_string(dataset)
        self.validate_kernel_string(parent_kernel)

        group = 'everyone'
        if mine:
            group = 'profile'

        kernels_list_result = self.process_response(
            self.kernels_list_with_http_info(
                page=page,
                page_size=page_size,
                group=group,
                user=user or '',
                language=language or 'all',
                kernel_type=kernel_type or 'all',
                output_type=output_type or 'all',
                sort_by=sort_by or 'hotness',
                dataset=dataset or '',
                competition=competition or '',
                parent_kernel=parent_kernel or '',
                search=search or ''))
        return [Kernel(k) for k in kernels_list_result]