code: def _update_linear_bucket_count(a_float, dist):
      
      buckets = dist.linearBuckets
      if buckets is None:
          raise ValueError(_BAD_UNSET_BUCKETS % (u'linear buckets'))
      bucket_counts = dist.bucketCounts
      num_finite_buckets = buckets.numFiniteBuckets
      if len(bucket_counts) < num_finite_buckets + 2:
          raise ValueError(_BAD_LOW_BUCKET_COUNT)
      width = buckets.width
      lower = buckets.offset
      upper = lower + (num_finite_buckets * width)
      if a_float < lower:
          index = 0
      elif a_float >= upper:
          index = num_finite_buckets + 1
      else:
          index = 1 + int(((a_float - lower) / width))
      bucket_counts[index] += 1
      _logger.debug(u'upper:%f, lower:%f, width:%f, sample:%f, index:%d',
                    upper, lower, width, a_float, index)
docs: Adds `a_float` to `dist`, updating the its linear buckets.
  
      Args:
        a_float (float): a new value
        dist (:class:`endpoints_management.gen.servicecontrol_v1_messages.Distribution`):
          the Distribution being updated
  
      Raises:
        ValueError: if `dist` does not already have linear buckets defined
        ValueError: if there are not enough bucket count fields in `dist`