def METHOD_NAME(
    adata: DataHandler.TYPE,
    target_col: str,
    *,
    groupby: Union[str, None, list[str]] = None,
    clip_at: int = 3,
    inplace: bool = True,
    key_added: Union[str, None] = None,
    fraction: bool = True,
    airr_mod="airr",
) -> Union[None, pd.Series]:
    """Counts the number of identical entries in `target_col`
    for each group in `group_by`.
    `nan`s in the input remain `nan` in the output.
    """
    params = DataHandler(adata, airr_mod)
    if target_col not in params.adata.obs.columns:
        raise ValueError("`target_col` not found in obs.")
    groupby = [groupby] if isinstance(groupby, str) else groupby
    groupby_cols = [target_col] if groupby is None else groupby + [target_col]
    clonotype_counts = (
        params.adata.obs.groupby(groupby_cols, observed=True)
        .size()
        .reset_index(name="tmp_count")
        .assign(
            tmp_count=lambda X: [f">= {min(n, clip_at)}" if n >= clip_at else str(n) for n in X["tmp_count"].values]
        )
    )
    clipped_count = params.adata.obs.merge(clonotype_counts, how="left", on=groupby_cols)["tmp_count"]
    clipped_count[_is_na(params.adata.obs[target_col])] = "nan"
    clipped_count.index = params.adata.obs.index
    if inplace:
        key_added = f"{target_col}_clipped_count" if key_added is None else key_added
        params.set_obs(key_added, clipped_count)
    else:
        return clipped_count