Adding some new function to scanpy

I have several papers under preparation some of them are related to dimensional reduction and some others related to clustering of differential expression of RNA-Seq. I have some codes in python for dimensional reduction or clustering for example assume ‘’New_method’ is a function for reduction and “New_cluster” is a new method for clustering I want to use the result of reduction and clustering in downstream analysis. For example, I want to run some code such as

sc.pl.umap(adata, color=[‘new_cluster’,‘leiden’, ‘CST3’, ‘NKG7’])
or

sc.tl.rank_genes_groups(adata, ’ new_cluster’, method=‘new_statistical_HT’)
and similar codes such as
pd.DataFrame(adata.uns[‘rank_genes_groups’][‘names’]).head(5)

Can anyone help me who I can do it?