def _median(values):
    """Return the median of a list of values"""
    n = len(values)
    if n < 1:
        return 0.0
    if n % 2 == 1:
        return sorted(values)[n//2]
    return sum(sorted(values)[n//2-1:n//2+1])/2.0