def lowstate_file_refs(chunks, extras=''):
 refs = {}
 for chunk in chunks:
  if (not isinstance(chunk, dict)):
   continue
  saltenv = 'base'
  crefs = []
  for state in chunk:
   if (state == '__env__'):
    saltenv = chunk[state]
   elif state.startswith('__'):
    continue
   crefs.extend(salt_refs(chunk[state]))
  if crefs:
   if (saltenv not in refs):
    refs[saltenv] = []
   refs[saltenv].append(crefs)
 if extras:
  extra_refs = extras.split(',')
  if extra_refs:
   for env in refs:
    for x in extra_refs:
     refs[env].append([x])
 return refs

def lowstate_file_refs ( chunks , extras = '' ) : refs = { } for chunk in chunks : if ( not isinstance ( chunk , dict ) ) : continue saltenv = 'base' crefs = [ ] for state in chunk : if ( state == '__env__' ) : saltenv = chunk [ state ] elif state . startswith ( '__' ) : continue crefs . extend ( salt_refs ( chunk [ state ] ) ) if crefs : if ( saltenv not in refs ) : refs [ saltenv ] = [ ] refs [ saltenv ] . append ( crefs ) if extras : extra_refs = extras . split ( ',' ) if extra_refs : for env in refs : for x in extra_refs : refs [ env ] . append ( [ x ] ) return refs
create a list of file ref objects to reconcile .