def migration_rate_in_interval(g, source, dest, time_interval):
    """
    Get the migration rate from source to dest over the given time interval.
    """
    rate = 0
    for mig in g.migrations:
        if mig.source == source and mig.dest == dest:
            if mig.start_time >= time_interval[0] and mig.end_time <= time_interval[1]:
                rate = mig.rate
    return rate