<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_sample(a_float, dist):
 """Adds `a_float` to `dist`, updating its existing 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 have known bucket options defined ValueError: if there are not enough bucket count fields in `dist` """

    dist_type, _ = _detect_bucket_option(dist)
    if dist_type == u'exponentialBuckets':
        _update_general_statistics(a_float, dist)
        _update_exponential_bucket_count(a_float, dist)
    elif dist_type == u'linearBuckets':
        _update_general_statistics(a_float, dist)
        _update_linear_bucket_count(a_float, dist)
    elif dist_type == u'explicitBuckets':
        _update_general_statistics(a_float, dist)
        _update_explicit_bucket_count(a_float, dist)
    else:
        _logger.error(u'Could not determine bucket option type for %s', dist)
        raise ValueError(u'Unknown bucket option type')