def median(pool):
    '''Statistical median to demonstrate doctest.
    >>> median([2, 9, 9, 7, 9, 2, 4, 5, 8])
    5
    '''
    copy = sorted(pool)
    size = len(copy)
    if size % 2 == 1:
        return copy[ int((size-1)/2)]
    else:
        return  (copy[int(size/2)-1] + copy[int(size/2)]) / 2
		
if __name__ == '__main__':
	import doctest
	doctest.testmod()