def _format_changes(changes, orchestration=False):
 if (not changes):
  return (False, u'')
 if orchestration:
  return (True, _nested_changes(changes))
 if (not isinstance(changes, dict)):
  return (True, u'Invalid Changes data: {0}'.format(changes))
 ret = changes.get('ret')
 if ((ret is not None) and (changes.get('out') == 'highstate')):
  ctext = u''
  changed = False
  for (host, hostdata) in six.iteritems(ret):
   (s, c) = _format_host(host, hostdata)
   ctext += (u'\n' + u'\n'.join((((u' ' * 14) + l) for l in s.splitlines())))
   changed = (changed or c)
 else:
  changed = True
  ctext = _nested_changes(changes)
 return (changed, ctext)

def _format_changes ( changes , orchestration = False ) : if ( not changes ) : return ( False , u'' ) if orchestration : return ( True , _nested_changes ( changes ) ) if ( not isinstance ( changes , dict ) ) : return ( True , u'Invalid Changes data: {0}' . format ( changes ) ) ret = changes . get ( 'ret' ) if ( ( ret is not None ) and ( changes . get ( 'out' ) == 'highstate' ) ) : ctext = u'' changed = False for ( host , hostdata ) in six . iteritems ( ret ) : ( s , c ) = _format_host ( host , hostdata ) ctext += ( u'\n' + u'\n' . join ( ( ( ( u' ' * 14 ) + l ) for l in s . splitlines ( ) ) ) ) changed = ( changed or c ) else : changed = True ctext = _nested_changes ( changes ) return ( changed , ctext )
format the changes dict based on what the data is .