def format_job_instance(job):
 ret = {'Function': job.get('fun', 'unknown-function'), 'Arguments': list(job.get('arg', [])), 'Target': job.get('tgt', 'unknown-target'), 'Target-type': job.get('tgt_type', []), 'User': job.get('user', 'root')}
 if ('metadata' in job):
  ret['Metadata'] = job.get('metadata', {})
 elif ('kwargs' in job):
  if ('metadata' in job['kwargs']):
   ret['Metadata'] = job['kwargs'].get('metadata', {})
 return ret

def format_job_instance ( job ) : ret = { 'Function' : job . get ( 'fun' , 'unknown-function' ) , 'Arguments' : list ( job . get ( 'arg' , [ ] ) ) , 'Target' : job . get ( 'tgt' , 'unknown-target' ) , 'Target-type' : job . get ( 'tgt_type' , [ ] ) , 'User' : job . get ( 'user' , 'root' ) } if ( 'metadata' in job ) : ret [ 'Metadata' ] = job . get ( 'metadata' , { } ) elif ( 'kwargs' in job ) : if ( 'metadata' in job [ 'kwargs' ] ) : ret [ 'Metadata' ] = job [ 'kwargs' ] . get ( 'metadata' , { } ) return ret
format the job instance correctly .