def write_cluster(adata, keys, cluster_fn, sep='\t'):
    """Export cell clustering as a text table
    """
    if not isinstance(keys, (list, tuple)):
        keys = [keys]
    for key in keys:
        if key not in adata.obs.keys():
            raise KeyError(f'{key} is not a valid `.uns` key')
    adata.obs[keys].reset_index(level=0).rename(columns={'index': 'cells'}
        ).to_csv(cluster_fn, sep=sep, header=True, index=False)
