def walk_outputs(object):
 out = []
 if isinstance(object, dict):
  for (key, val) in sorted(object.items()):
   if isdefined(val):
    out.extend(walk_outputs(val))
 elif isinstance(object, (list, tuple)):
  for val in object:
   if isdefined(val):
    out.extend(walk_outputs(val))
 elif (isdefined(object) and isinstance(object, (str, bytes))):
  if (os.path.islink(object) or os.path.isfile(object)):
   out = [(filename, u'f') for filename in get_all_files(object)]
  elif os.path.isdir(object):
   out = [(object, u'd')]
 return out

def walk_outputs ( object ) : out = [ ] if isinstance ( object , dict ) : for ( key , val ) in sorted ( object . items ( ) ) : if isdefined ( val ) : out . extend ( walk_outputs ( val ) ) elif isinstance ( object , ( list , tuple ) ) : for val in object : if isdefined ( val ) : out . extend ( walk_outputs ( val ) ) elif ( isdefined ( object ) and isinstance ( object , ( str , bytes ) ) ) : if ( os . path . islink ( object ) or os . path . isfile ( object ) ) : out = [ ( filename , u'f' ) for filename in get_all_files ( object ) ] elif os . path . isdir ( object ) : out = [ ( object , u'd' ) ] return out
extract every file and directory from a python structure .