'Create the Service protobuf.
Args:
job: Launchdjobdict from servicemanagement framework.
Returns:
sysinfo_pb2.OSXServiceInformation proto'

def CreateServiceProto(self, job):

    service = rdf_client.OSXServiceInformation(label=job.get('Label'), program=job.get('Program'), sessiontype=job.get('LimitLoadToSessionType'), lastexitstatus=int(job['LastExitStatus']), timeout=int(job['TimeOut']), ondemand=bool(job['OnDemand']))
    for arg in job.get('ProgramArguments', '', stringify=False):
        service.args.Append(unicode(arg))
    mach_dict = job.get('MachServices', {}, stringify=False)
    for (key, value) in mach_dict.iteritems():
        service.machservice.Append(('%s:%s' % (key, value)))
    job_mach_dict = job.get('PerJobMachServices', {}, stringify=False)
    for (key, value) in job_mach_dict.iteritems():
        service.perjobmachservice.Append(('%s:%s' % (key, value)))
    if ('PID' in job):
        service.pid = job['PID'].value
    return service
