How to write a condition to filter out the values in Percentiles

I am writing a logic for calculating a metric like this

create_logit_value (df,“SA”,
“SA”,10,
-------- (so on)
“SA”,1)

How do we write a condition to filter the value like suppose 10 after them into deciles.