this should probably be a Twig test rather than a twig function