Fixing mesh normals

My script generates a mesh but it’s visible from the inside. How do I fix it so it’s visible in outside and culled in inside?

Triangles need to be clockwise.