def rewrite_str_with_trie(sval, trie, boundaries = False, slow = False):
if boundaries:<EOL><INDENT>sval = fsed.ahocorasick.boundary_transform(sval)<EOL><DEDENT>if slow:<EOL><INDENT>sval = trie.replace(sval)<EOL><DEDENT>else:<EOL><INDENT>sval = trie.greedy_replace(sval)<EOL><DEDENT>if boundaries:<EOL><INDENT>sval = '<STR_LIT>'.join(fsed.ahocorasick.boundary_untransform(sval))<EOL><DEDENT>return sval<EOL>
Rewrites a string using the given trie object.

Arguments:
- `sval`:
- `trie`:
- `boundaries`:
- `slow`: