intelli_plug: cherry-picked from mako