def format_wf_instances(instances):
 has_wf = False
 for instance in instances:
  if (not getattr(instance, 'children', None)):
   continue
  else:
   has_wf = True
   break
 if (not has_wf):
  return instances
 for instance in instances:
  if getattr(instance, 'children', None):
   instance.id = (WF_PREFIX + instance.id)
  else:
   instance.id = (NON_WF_PREFIX + instance.id)
 return instances

def format_wf_instances ( instances ) : has_wf = False for instance in instances : if ( not getattr ( instance , 'children' , None ) ) : continue else : has_wf = True break if ( not has_wf ) : return instances for instance in instances : if getattr ( instance , 'children' , None ) : instance . id = ( WF_PREFIX + instance . id ) else : instance . id = ( NON_WF_PREFIX + instance . id ) return instances
adds identification characters to a workflow and appropriately shifts the non-workflow instances .