Surround a blueprint with walls

When given a Factorio blueprint, gives one that is the same but surrounded by a wall of specified depth.

It's a bit bugged because the blueprint data doesn't contain the size of the entities in it, only their top-leftmost corner's placement.

If you have a fix, feel free to commit it!

Error: Please specify blueprint
Kenwood House Gardens
51°34′17.0″N 0°10′9.3″W
zemnmez
Thomas Shadwell LogoA 2D pyramidal frustum (triangle with the top missing). In the center is an open eye, below the eye, a single tear.
Thomas NJ Shadwell