def mean_expression(df, annotation, stage_regex=r".*", normal=False):
    """Return the mean expression values of the subset of samples.

    Parameters
    ----------
        df: pandas.DataFrame
            Each row is a gene and each column is a sample.
        annotation: pandas.DataFrame
            A data frame with matching uuids and tumor stages.
        stage_regex: raw str, optional
            The regex used for filtering the "tumor_stage" column. Choose all by default.
        normal: bool, optional
            Return normal samples. Default is false.
    Returns
    -------
        a pandas.Series with names as Ensembl IDs and values as TPMs, and
        a list of sample names.
    """
    normalUUID = annotation[annotation["sample_type"].str.lower().str.contains("normal")]["uuid"].tolist()
    if normal:
        return df[normalUUID].mean(1)
    ids = annotation[
        (~annotation["uuid"].isin(normalUUID)) &
        (annotation["tumor_stage"].str.contains(stage_regex, regex=True))]["uuid"].tolist()
    return (df[ids].mean(1), ids)