def intersect(f, g):
    """Return the intersection of two FSTs

    Both arguments are assumed to be length preserving mappings.
    """
    res = f.copy()
    res.conjunct(g)
    res.minimize()
    return res
