Rinse the basmati rice in several changes of cold water until the water runs clear. Leave the rice to soak in cold water for 20 minutes.
While the rice soaks, place a large frying pan over medium heat.
Add the sesame seeds and toast for 2-3 minutes, stirring frequently, until golden and fragrant. Immediately transfer them to a small bowl to prevent burning.
Return the same pan to the heat and add the oil.
Once hot, add the optional curry leaves.
When they begin to crackle, add the sliced red onions and cumin seeds.
Cook for about 15 minutes, stirring occasionally, until the onions are very soft, golden, and sweet.
Stir the black pepper, tamarind paste, salt, and ground red chile into the onions.
Mix well, then remove the pan from the heat and set aside.
Drain the soaked rice and transfer it to a deep saucepan.
Cover with 3 cups (750ml) of fresh cold water and bring to a boil.
Reduce the heat to a simmer and cook for 10 minutes, or until the rice is tender.
Drain the cooked rice completely.
Cover the saucepan with a clean tea towel and then the lid, and let it steam off the heat for 5 minutes to become light and fluffy.
Fluff the steamed rice with a fork and transfer it to the pan with the caramelized onion mixture.
Place the pan back over low heat and gently fold everything together until the rice is evenly coated and heated through.
Stir in the toasted sesame seeds, remove from the heat, and serve immediately.
Don't rush the onions.
Cooking them slowly for the full 15 minutes is key to developing a deep, sweet flavor that balances the tangy tamarind.
Adjust the tamarind to your taste. Tamarind pastes vary in concentration. Start with the recommended amount, taste, and add more if you prefer a tarter flavor.