def copy_to_ram(storage):
 import shutil
 ram = RamStorage()
 for name in storage.list():
  f = storage.open_file(name)
  r = ram.create_file(name)
  shutil.copyfileobj(f.file, r.file)
  f.close()
  r.close()
 return ram

def copy_to_ram ( storage ) : import shutil ram = RamStorage ( ) for name in storage . list ( ) : f = storage . open_file ( name ) r = ram . create_file ( name ) shutil . copyfileobj ( f . file , r . file ) f . close ( ) r . close ( ) return ram
copies the given filestorage object into a new ramstorage object .