def extract_used_columns_from_nba_response(nba_response, desired_column_headers):
    """
    Keeps all columns specified in desired_column_headers
    and returns the processed list of rows.
    """
    try:
        desired_column_indicies = [nba_response.headers.index(
            header) for header in desired_column_headers]
    except ValueError:
        raise ValueError('nba response headers are inconsistent: {} \n\n {}'.format(
            nba_response.headers,
            desired_column_headers
        ))

    rows = nba_response.rows
    filtered_rows = []
    for row in rows:
        filtered_rows.append([row[i] for i in desired_column_indicies])
    return filtered_rows