def compute_ber_size(data):
    """
    Compute size according to BER definite length rules
    Returns size of value and value offset
    """
    if data[1] <= 127:
        return data[1], 2
    else:
        bytes_length = data[1] - 128
        value_length = 0
        cont = bytes_length
        for byte in data[2:2 + bytes_length]:
            cont -= 1
            value_length += byte * 256 ** cont
        return value_length, bytes_length + 2
