from typing import List
import statistics


def median_absolute_deviation(data: List):
    """
    Calculate the sample `median absolute deviation (MAD)
    <https://en.wikipedia.org/wiki/Median_absolute_deviation/>`_, defined as
    median(abs(data - median(data)).

    Parameters
    ----------

    data: List
        List of data points.

    Returns
    -------

    mad: float
        The median absolute deviation of the data.

    """

    data_median = statistics.median(data)
    normalized_data = []
    for item in data:
        normalized_data.append(abs(item - data_median))
    mad = statistics.median(normalized_data)
    return mad