Wash papaya and peel the skin.
Grate it in a food processor or using a hand grater.
Heat a pan with ghee. Add chopped almonds or cashews and fry till they turn slightly golden. Transfer to a plate. Add raisins if using, fry until they swell up. Remove them to a plate.
Add grated papaya and begin to cook. It begins to release juices.
Sprinkle desiccated coconut or flour, ½ tsp at one time and mix well to prevent lumps. Repeat till the entire flour is used up. Cook till the juices almost evaporate. Flour is used to absorb the juices, else the cooking time will be more.
Add sugar, cardamom powder and mix well. I powdered cardamom along with little sugar. Check the sweetness. If needed add more.
Cook stirring occasionally till the sugar blends well with the papaya.
Turn off the stove when the papaya halwa turns thick. Garnish with nuts & raisins.