def geomean(iterable):
    """
    Returns the geometric mean (the n-th root of the product of n terms) of an iterable
    """
    n = 0
    first_item = True
    for x in iterable:
        n += 1
        if first_item:
            product = x
            first_item = False
        else:
            product *= x
    return product ** (1 / float(n))
