def create_migration_flow(obj, config, migration):
    """
    Creates migration flow for object ``obj`` based on configuration ``config``
    migration ``migration``.
    :param obj: model.Model instance
    :param config: configuration
    :param migration: migration (part of configuration)
    :return: migration flow for an object
    """

    if obj.find_link(migration.destination) is not None:
        return None
    cls = obj.get_class()
    flow_factories = migration.migration_flow_factories
    if cls not in flow_factories:
        raise RuntimeError('Failed to find migration flow factory')
    else:
        flow = linear_flow.Flow('top_level_' + taskflow_utils.object_name(obj),
                                retry=retry.AlwaysRevert())
        factory = flow_factories[cls]()
        migration_tasks = factory.create_flow(config, migration, obj)
        flow.add(*migration_tasks)
        return flow
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/os/migrate/base.py/create_migration_flow/original