Purity validation

I think it will be quite enough for purposes of my library. Do you know name of utility function which checks that given AST is valid guard? Or maybe some guesses where to search it?