def migrate(dest_datastore, source_datastore):
        """
        Copy all records from source_datastore to dest_datastore
        """
        for uid in source_datastore.list():
            try:
                paste = source_datastore._retrieve(uid)
            except Exception as exc:
                print(
                    "{exc.__class__.__name__} occurred retrieving {uid}: {exc}"
                    .format(exc=exc, uid=uid),
                    file=sys.stderr)
                continue
            data = paste.pop('data', None)
            try:
                dest_datastore._store(uid, paste, data)
            except Exception as exc:
                print(
                    "{exc.__class__.__name__} occurred storing {uid}: {exc}"
                    .format(exc=exc, uid=uid),
                    file=sys.stderr)
                continue
def migrate ( dest_datastore , source_datastore ) : for uid in source_datastore . list ( ) : try : paste = source_datastore . _retrieve ( uid ) except Exception as exc : print ( "{exc.__class__.__name__} occurred retrieving {uid}: {exc}" . format ( exc = exc , uid = uid ) , file = sys . stderr ) continue data = paste . pop ( 'data' , None ) try : dest_datastore . _store ( uid , paste , data ) except Exception as exc : print ( "{exc.__class__.__name__} occurred storing {uid}: {exc}" . format ( exc = exc , uid = uid ) , file = sys . stderr ) continue
Copy all records from source_datastore to dest_datastore