Format the changes dict based on what the data is

def _format_changes(changes, orchestration=False):
    '''
    Format the changes dict based on what the data is
    '''
    if not changes:
        return False, ''

    if orchestration:
        return True, _nested_changes(changes)

    if not isinstance(changes, dict):
        return True, 'Invalid Changes data: {0}'.format(changes)

    ret = changes.get('ret')
    if ret is not None and changes.get('out') == 'highstate':
        ctext = ''
        changed = False
        for host, hostdata in six.iteritems(ret):
            s, c = _format_host(host, hostdata)
            ctext += '\n' + '\n'.join((' ' * 14 + l) for l in s.splitlines())
            changed = changed or c
    else:
        changed = True
        ctext = _nested_changes(changes)
    return changed, ctext