def extract_year_range(data_array, colnames, min_years, max_years, pivot_yr=0):
    """Determine the minimum and maximum years of data in a given AEO file.

    For a given AEO data file that has been imported and formatted
    into a numpy structured array, this function looks in the column(s)
    specified for the minimum and maximum calendar years reported.
    Ultimately, this function produces a conservative range for the
    minimum and maximum years across those columns, taking the largest
    (latest) of the reported minimum years and the smallest (earliest)
    of the reported maximum years. The handling of column names is done
    based on whether there are one or two columns given. In the case
    where there are two columns, they are assumed to represent low
    (e.g., market entry year) and high (e.g., market exit year) year
    datasets.

    Args:
        data_array (numpy.ndarray): A numpy structured array of EIA AEO
            residential or commercial building energy and stock or
            equipment characteristic data.
        colnames (list): List of strings specifying the name(s) of the
            column(s) containing year data.
        min_years (list): The earliest years found in the imported data.
        max_years (list): The latest years found in the imported data.
        pivot_yr (int): Optional pivot year needed for some data that
            must be adjusted to be in the form YYYY.

    Returns:
        Updated lists of minimum and maximum years with the minimum
        and maximum found in data_array.
    """

    # Preallocate minimum and maximum year variables
    min_yr = 0
    max_yr = 10000

    # If there are two columns given, assume that they represent lower
    # bound and upper bound years, and obtain the min from the lower
    # bound set and the max from the upper bound set of years
    if len(colnames) == 2:
        data_array_min_years = data_array[colnames[0]]
        data_array_max_years = data_array[colnames[1]]

        min_yr = min(data_array_min_years)
        max_yr = max(data_array_max_years)

    # Otherwise, assume all the columns of year data are directly
    # comparable and run through all of them to obtain a _conservative_
    # indication of the min and max years in the data
    else:
        for name in colnames:
            data_array_years = data_array[name]

            min_yr = max(min_yr, min(data_array_years))
            max_yr = min(max_yr, max(data_array_years))

    # Circumvents the action of .append() modifying in place the lists
    # passed to the function
    new_min_years = min_years + [min_yr + pivot_yr]
    new_max_years = max_years + [max_yr + pivot_yr]

    return new_min_years, new_max_years