def _get_top_level_images(imagedata, subset=None):
 try:
  parents = [imagedata[x]['ParentId'] for x in imagedata]
  filter_ = (subset if (subset is not None) else imagedata)
  return [x for x in filter_ if (x not in parents)]
 except (KeyError, TypeError):
  raise CommandExecutionError('Invalid image data passed to _get_top_level_images(). Please report this issue. Full image data: {0}'.format(imagedata))

def _get_top_level_images ( imagedata , subset = None ) : try : parents = [ imagedata [ x ] [ 'ParentId' ] for x in imagedata ] filter_ = ( subset if ( subset is not None ) else imagedata ) return [ x for x in filter_ if ( x not in parents ) ] except ( KeyError , TypeError ) : raise CommandExecutionError ( 'Invalid image data passed to _get_top_level_images(). Please report this issue. Full image data: {0}' . format ( imagedata ) )
returns a list of the top-level images .