def median(values):
    """Returns the central (median) value of a list.
    If the list has an even amount of numbers,
    then the average of the two
    central numbers shall be returned.

    Args:
        values (list)

    Returns:
        float: The central value"""
    if len(values) == 0:
        return None
    values.sort()
    if len(values) % 2 == 0:
        position = int(len(values) / 2)
        a = values[position - 1]
        b = values[position]
        return (a + b) / 2
    else:
        position = int((len(values) / 2) - 0.5)
        return values[position]