<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _buckets_nearly_equal(a_dist, b_dist):
 """Determines whether two `Distributions` are nearly equal. Args: a_dist (:class:`Distribution`):
 an instance b_dist (:class:`Distribution`):
 another instance Return: boolean: `True` if the two instances are approximately equal, otherwise False """

    a_type, a_buckets = _detect_bucket_option(a_dist)
    b_type, b_buckets = _detect_bucket_option(b_dist)
    if a_type != b_type:
        return False
    elif a_type == u'linearBuckets':
        return _linear_buckets_nearly_equal(a_buckets, b_buckets)
    elif a_type == u'exponentialBuckets':
        return _exponential_buckets_nearly_equal(a_buckets, b_buckets)
    elif a_type == u'explicitBuckets':
        return _explicit_buckets_nearly_equal(a_buckets, b_buckets)
    else:
        return False