#NEWLINE# def copy_to_ram( storage ) : #NEWLINE# #INDENT# 'Copies the given FileStorage object into a new RamStorage object.\n    :rtype: :class:`RamStorage`\n    ' #NEWLINE# import shutil #NEWLINE# ram = RamStorage ( ) #NEWLINE# for name in storage . list ( ) : #NEWLINE# #INDENT# f = storage . open_file ( name ) #NEWLINE# r = ram . create_file ( name ) #NEWLINE# shutil . copyfileobj ( f . file , r . file ) #NEWLINE# f . close ( ) #NEWLINE# r . close ( ) #NEWLINE# #UNINDENT# return ram