'Sets the various fields of test object of the tko protocol.
Method takes a tko test and a new test of the protocol buffer and
transfers the values in the tko test to the new test.
:param
tko_test: a tko test instance.
pb_test: an empty protocol buffer test instance.'

def set_pb_test(self, tko_test, pb_test):

    self.set_trivial_attr(tko_test, pb_test, self.test_type_dict)
    self.set_pb_kernel(tko_test.kernel, pb_test.kernel)
    for current_iteration in tko_test.iterations:
        pb_iteration = pb_test.iterations.add()
        self.set_pb_iteration(current_iteration, pb_iteration)
    for (key, val) in tko_test.attributes.iteritems():
        newkeyval = pb_test.attributes.add()
        newkeyval.name = key
        newkeyval.value = str(val)
    for current_label in tko_test.labels:
        pb_test.labels.append(current_label)
