There's a helper that will handle this, get_turf()