title: Mask 2D array preserving shape
body: <p>I have 2D numpy array something like this:</p>
  
  <pre><code>arr = np.array([[1,2,4],
                  [2,1,1],
                  [1,2,3]])
  </code></pre>
  
  <p>and a boolean array:</p>
  
  <pre><code>boolarr = np.array([[True, True, False],
                      [False, False, True],
                      [True, True,True]])
  </code></pre>
  
  <p>Now, when I try to slice arr based on boolarr, it gives me</p>
  
  <pre><code>arr[boolarr]
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>array([1, 2, 1, 1, 2, 3])
  </code></pre>
  
  <p>But I am looking to have a 2D array output instead. The desired output is</p>
  
  <pre><code>[[1, 2],
   [1],
   [1, 2, 3]]
  </code></pre>