title: How to check dimensions of a numpy array?
body: <p>I want to do something like this inside a function:</p>
  
  <pre><code>if image.shape == 2 dimensions
      return image # this image is grayscale
  else if image.shape = 3 dimensions
      return image # image is either RGB or YCbCr colorspace
  </code></pre>
  
  <p>Here, the image is a numpy array. I am not able to define that checking condition. I am really stuck at this point. Can anyone please help?</p>