import re


def get_derived_table(view_list):
    """
    This function extracts the derived table clause from a view file, if it exists.

    :param view_list: view file broken down list

    :type view_list: list

    :return: a list of the derived table clause for a view file
    """
    derived_list = []
    for line in view_list:

        line_list = list(filter(None, line.split(' ')))
        derived_list.append(line_list)
        end_of_derived_table = sum([bool(re.search('dimension', s) or re.search('parameter', s) or re.search('measure', s)) for s in line_list])

        if end_of_derived_table > 0:
            break
            
    return derived_list[1:-1]