def METHOD_NAME(vm):
    last_transfer_mem = 0
    transfered_mem = 0
    mig_stat = Statistic()
    while vm.monitor.get_migrate_progress() == 0:
        pass
    for _ in range(30):
        o = vm.monitor.info("migrate")
        warning_msg = ("Migration already ended. Migration speed is"
                       " probably too high and will block vm while"
                       " filling its memory.")
        fail_msg = ("Could not determine the transferred memory from"
                    " monitor data: %s" % o)
        if isinstance(o, six.string_types):
            if "status: active" not in o:
                test.error(warning_msg)
            try:
                transfered_mem = int(get_mig_speed.search(o).groups()[0])
            except (IndexError, ValueError):
                test.fail(fail_msg)
        else:
            if o.get("status") != "active":
                test.error(warning_msg)
            try:
                transfered_mem = o.get("ram").get("transferred") / (1024)
            except (IndexError, ValueError):
                test.fail(fail_msg)
        real_mig_speed = (transfered_mem - last_transfer_mem) / 1024
        last_transfer_mem = transfered_mem
        test.log.debug("Migration speed: %s MB/s", real_mig_speed)
        mig_stat.record(real_mig_speed)
        time.sleep(1)
    return mig_stat