def _median_of_three(array, lower, upper):
    """Finds median approximate median value of an array.

    Approximate the median (median value is the middle value of a sorted list 
    of elements) value using three values of a list: first, middle and last 
    elements. First and last do not need to be the absolute values, rather than
    relative values using lower and upper limit arguments. 

    Args:
        array (list) -- List of unordered elements.
        lower (int) -- Left-most element (lower limit).
        upper (int) -- Right-most element (upper limit).

    Returns: 
        int: Median element.
    """
    mid =  (lower + upper) // 2
    a = array[lower]
    b = array[mid]
    c = array[upper]
    # As only three unordered elements are passed down, the middle element must 
    # be found through comparisons
    if a <= b <= c or c <= b <= a:
        return mid
    if a <= c <= b or b <= c <= a:
        return upper

    return lower