def check_for_valid_data_length(image_data, data_to_hide):
    """
    Check if cover image is significantly large enough to encode all the data

    Since we are using the lsb of the cover image to encode the data it takes three pixels to hide one byte of data.
    That is three bits in the R and G values and two bits plus a flag bit in the B value. So we require an image that
    is three times as large as the data we want to hide.
    """
    data_len = len(data_to_hide)
    if data_len == 0:
        raise ValueError('No data was provided to hide')
    if data_len * 3 > len(image_data):
        raise ValueError('The data provided is too large to fit in the image')
    return data_len
