def completion_score_flag(
    df,
    photo_bit_binary="mhm_PhotoBitBinary",
    has_genus="mhm_HasGenus",
    sub_completeness="mhm_SubCompletenessScore",
    completeness="mhm_CumulativeCompletenessScore",
    inplace=False,
):
    """
    Adds the following completness score flags:
    - `SubCompletenessScore`: The percentage of the watersource photos, larvae photos, abdomen photos, and genus columns that are filled out.
    - `CumulativeCompletenessScore`: The percentage of non null values out of all the columns.

    Parameters
    ----------
    df : pd.DataFrame
        A mosquito habitat mapper DataFrame with the [`PhotoBitDecimal`](#photo_bit_flags) and [`HasGenus`](#has_genus_flags) flags.
    photo_bit_binary: str, default="mhm_PhotoBitBinary"
        The name of the column in the mosquito habitat mapper DataFrame that contains the PhotoBitBinary flag.
    sub_completeness : str, default="mhm_HasGenus"
        The name of the column in the mosquito habitat mapper DataFrame that will contain the generated SubCompletenessScore flag.
    completeness : str, default="mhm_SubCompletenessScore"
        The name of the column in the mosquito habitat mapper DataFrame that will contain the generated CumulativeCompletenessScore flag.
    inplace : bool, default=False
        Whether to return a new DataFrame. If True then no DataFrame copy is not returned and the operation is performed in place.

    Returns
    -------
    pd.DataFrame
        A DataFrame with completion score flags. If `inplace=True` it returns None.
    """

    def sum_bit_mask(bit_mask="0"):
        total = 0.0
        for char in bit_mask:
            total += int(char)
        return total

    if not inplace:
        df = df.copy()

    scores = {}
    scores["sub_score"] = []
    # Cummulative Completion Score
    scores["cumulative_score"] = round(df.count(axis=1) / len(df.columns), 2)
    # Sub-Score
    for index in df.index:
        bit_mask = df[photo_bit_binary][index]
        sub_score = df[has_genus][index] + sum_bit_mask(bit_mask=bit_mask)
        sub_score /= 4.0
        scores["sub_score"].append(sub_score)

    df[sub_completeness], df[completeness] = (
        scores["sub_score"],
        scores["cumulative_score"],
    )

    if not inplace:
        return df