<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def preview(self, **query_params):
 """Returns a streaming handle to this job's preview search results. Unlike :class:`splunklib.results.ResultsReader`, which requires a job to be finished to return any results, the ``preview`` method returns any results that have been generated so far, whether the job is running or not. The returned search results are the raw data from the server. Pass the handle returned to :class:`splunklib.results.ResultsReader` to get a nice, Pythonic iterator over objects, as in:: import splunklib.client as client import splunklib.results as results job = service.jobs.create("search * | head 5") rr = results.ResultsReader(job.preview()) for result in rr: if isinstance(result, results.Message):
 # Diagnostic messages may be returned in the results print '%s: %s' % (result.type, result.message) elif isinstance(result, dict):
 # Normal events are returned as dicts print result if rr.is_preview: print "Preview of a running search job." else: print "Job is finished. Results are final." This method makes one roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set to ``True``. :param query_params: Additional parameters (optional). For a list of valid parameters, see `GET search/jobs/{search_id}/results_preview <http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#GET_search.2Fjobs.2F.7Bsearch_id.7D.2Fresults_preview>`_ in the REST API documentation. :type query_params: ``dict`` :return: The ``InputStream`` IO handle to this job's preview results. """

        query_params['segmentation'] = query_params.get('segmentation', 'none')
        return self.get("results_preview", **query_params).body