def compute_bits(image, start, end, newName):
    """ Compute the bits of an image

    :param image: image that contains the band with the bit information
    :type image: ee.Image
    :param start: start bit
    :type start: int
    :param end: end bit
    :type end: int
    :param newName: new name for the band
    :type newName: str
    :return: a single band image of the extracted bits, giving the band
        a new name
    :rtype: ee.Image
    """
    pattern = 0

    for i in range(start, end + 1):
        pattern += 2**i

    return image.select([0], [newName]).bitwiseAnd(pattern).rightShift(start)