def migrate_node(node):
 for (key, file_id) in node.files_current.iteritems():
  if (key not in node.files_versions):
   node.files_versions[key] = [file_id]
  elif (file_id not in node.files_versions[key]):
   node.files_versions[key].append(file_id)
 node.save()

def migrate_node ( node ) : for ( key , file_id ) in node . files_current . iteritems ( ) : if ( key not in node . files_versions ) : node . files_versions [ key ] = [ file_id ] elif ( file_id not in node . files_versions [ key ] ) : node . files_versions [ key ] . append ( file_id ) node . save ( )
ensure that all keys present in files_current are also present in files_versions .