def METHOD_NAME(adata, subset_variable, count_variable="celltype", plot_percentages=True, figsize=(8,4)):
    """Generate a stacked bar plot of the percentage of labelcounts within each AnnData subset
    parameters
    ----------
    adata: AnnData
      the AnnData object
    subset_variable: `str`
        string identifying the column name of adata.obs along which the AnnData object should be subsetted
    count_variable: `str` | default  = 'celltype'
        string identiyfing the column of adata.obs containing the labels to be counted
    plot_percentages: `bool` | default = True
        boolian indicating if the percentages or the total counts should be plotted
    figsize: (width, height) or None | default = (8,4)
        optional parameter to define the figure size of the plot that is to be generated
    returns
    -------
    Figure
    Example
    -------
    >>> import besca as bc
    >>> adata = bc.datasets.simulated_Kotliarov2020_processed()
    >>> adata.obs   = adata.obs.astype( {'batch' :  'category'})
    >>> fig = bc.pl.celllabel_quant_stackedbar(adata, count_variable = 'leiden', subset_variable = 'donor')
    .. plot::
        >>> import besca as bc
        >>> adata = bc.datasets.simulated_Kotliarov2020_processed()
        >>> adata.obs   = adata.obs.astype( {'batch' :  'category'})
        >>> fig = bc.pl.celllabel_quant_stackedbar(adata, count_variable = 'leiden', subset_variable = 'batch')
    """
    counts_celltype = count_occurrence_subset(
        adata, subset_variable, count_variable=count_variable, return_percentage=False
    )
    values = DataFrame(
        index=natsorted(counts_celltype.index.tolist()),
        columns=counts_celltype.columns.tolist(),
    )
    for cell in counts_celltype.index.tolist():
        data = counts_celltype.loc[cell].tolist()
        if plot_percentages:
            data = [x / sum(data) for x in data]
        values.loc[cell] = data
    fig = None
    if figsize is not None:
        fig = values.plot(kind="bar", stacked=True, figsize=(figsize[0], figsize[1]))
    else:
        fig = values.plot(kind="bar", stacked=True, figsize=(8, 4))
    if plot_percentages:
        fig.set_ylabel("percentage")
    else:
        fig.set_ylabel("number of cells")
    fig.legend(bbox_to_anchor=(1, 1))
    # fix figure axis to include legend
    tight_layout()
    # return figure
    return fig