def valid_image_array(image_array):
    """
    Returns `True` if and image array is valid.
    An image array is valid if it is in grayscale (having 2 dimensions) or in color
    (having 3 dimensions)

    :param image_array: Image as an array
    :type image_array: :class:`~numpy:numpy.ndarray`
    :return: Returns `True` if an image array is valid, otherwise `False`
    :rtype: :class:`bool`
    """
    source_is_grayscale = len(image_array.shape) == 2
    source_is_color = len(image_array.shape) == 3 and image_array.shape[2] == 3
    return source_is_grayscale or source_is_color