def METHOD_NAME(orient_client, stream_out, targets, time_range):
    writer = ndjson.writer(stream_out)
    with pull.PullStatsOutput('Pull orient DB') as output:
        if model.PullTarget.HISTORY_FLOW_EVENT in targets:
            _pull_flow_events(orient_client, time_range, writer, output)
        output.flush()
        if model.PullTarget.HISTORY_PORT_EVENT in targets:
            _pull_port_events(orient_client, time_range, writer, output)