<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_migrations(migrations):
 """ Run migrations for a resource type :param: a dicitionary of migrations """

    for resource, resource_migrations in migrations.items():
        for version in resource_migrations:
            to_migrate = yield resource_version.get(
                key=[resource.resource_type, version],
                include_docs=True)

            for x in to_migrate['rows']:
                instance = resource(**x['doc'])
                instance = _migrate_resource(
                    instance,
                    resource_migrations,
                    version
                )

                yield instance._save()