def get_valid_columns(dataframes, contribution_type, row_sheet_name):
    """
    Function is used to determine the columns to be investigated in
    across all of the site report dataframes. The columns should all
    be the same in the 'source' sheet (otherwise an error is thrown).

    The columns of interest are those that can help elucidate an
    HPO site's relative contribution (total rows, well defined rows,
    etc.)

    :param
    dataframes (lst): list of pandas dataframes loaded from the Excel
        files generated from the analysis reports

    contribution_type (str): string representing the types of columns to
        look at for the dataframe. either can represent the 'total' row
        metrics or the 'error' metrics for a particular column.

    row_sheet_name (str): sheet name within the analytics files that
        show the total number of rows and the number of well defined
        rows

    :return:
    valid_cols (lst): list of the columns that are consistent across all
        of the sheets and relevant to the HPO weighting report needed
    """
    valid_cols = []

    # find the columns you want to investigate
    for df in dataframes:
        for column in df:
            if contribution_type == 'total' and len(column) > 9 and \
                    column[-9:] == 'total_row':
                valid_cols.append(column)
            elif contribution_type == 'valid' and len(column) > 16 and \
                    column[-16:] == 'well_defined_row':
                valid_cols.append(column)

    valid_cols = list(dict.fromkeys(valid_cols))
    valid_cols.sort()

    return valid_cols