def _remove_trailing_nan(linelist):
    """Private function to clean project_value_list. Removes trailing nan's which
    are empty sub-project cells. As an example, input ["nan", 1, 2, "nan", "nan"]
    will return ["nan", 1, 2].
    """
    clean = linelist
    # Looping through reversed list to get trailing values
    for field in linelist[::-1]:
        # skip over over empty lines or nan values
        if not field or field == 'nan':
            removed = clean.pop()
        else:
            break # break when encountering first non-empty string or non-nan

    return clean