def _median(data_sorted):
    """
    Compute the median value of a sequence of values.

    :param data_sorted: A sorted sequence of :class:`decimal.Decimal`.
    :returns: :class:`decimal.Decimal`.
    """
    length = len(data_sorted)
    if length % 2 == 1:
        return data_sorted[(length + 1) // 2 - 1]
    else:
        half = length // 2
        a = data_sorted[half - 1]
        b = data_sorted[half]
    return (a + b) / 2
