<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def view(results_dir, result_id, hide_simulation_output, parameters, no_pager):
 """ View results of simulations. """


    campaign = sem.CampaignManager.load(results_dir)

    # Pick the most appropriate function based on the level of detail we want
    if hide_simulation_output:
        get_results_function = campaign.db.get_results
    else:
        get_results_function = campaign.db.get_complete_results

    # If a result id was specified, just query for that result
    if result_id:
        output = '\n\n\n'.join([pprint.pformat(item) for item in
                                get_results_function(result_id=result_id)])
    else:

        [params, defaults] = zip(*get_params_and_defaults(
            campaign.db.get_params(), campaign.db))

        if not parameters:
            # Convert to string
            string_defaults = list()
            for idx, d in enumerate(defaults):
                string_defaults.append(str(d))

            script_params = query_parameters(params, string_defaults)
        else:
            script_params = import_parameters_from_file(parameters)

        # Perform the search
        output = '\n\n\n'.join([pprint.pformat(item) for item in
                                get_results_function(script_params)])

    # Print the results
    if no_pager:
        click.echo(output)
    else:
        click.echo_via_pager(output)