diff --git a/utils.py b/utils.py
index c163954b56ae851eb062637467ded9f13a77bb67..6e620b5f28ff6aee874d666e0881d889c1fdf033 100644
--- a/utils.py
+++ b/utils.py
@@ -5,6 +5,7 @@ from typing import Mapping
 from collections import Counter
 
 import sympy as sp
+import numpy as np
 
 
 class DotDict(dict):
@@ -87,6 +88,20 @@ def fully_contains(l1, l2):
     return True
 
 
+def boolean_array_bounding_box(boolean_array):
+    """Returns bounding box around "true" area of boolean array"""
+    dim = len(boolean_array.shape)
+    bounds = []
+    for i in range(dim):
+        for j in range(dim):
+            if i != j:
+                arr_1d = np.any(boolean_array, axis=j)
+        begin = np.argmax(arr_1d)
+        end = begin + np.argmin(arr_1d[begin:])
+        bounds.append((begin, end))
+    return bounds
+
+
 class LinearEquationSystem:
     """Symbolic linear system of equations - consisting of matrix and right hand side.