Heat the oil in a large heavy-bottomed pot or skillet. Add the diced onions and hot pepper and cook for five minutes, until the onions are translucent. Add the garlic, curry powder, cumin, turmeric, cardamom, and salt, and cook for one minute more.
Add the drained beans to the onions, along with the tomatoes and their juices and the coconut milk. Bring to a boil, then reduce the heat to low and cook for about 15 minutes, until the coconut milk thickens a bit and the flavours meld. The level of the sauce should come up to just cover the beans. If there’s not enough liquid, add a bit of water and cook another minute or two. Taste the maharagwe, and add more salt if it needs it or more cayenne pepper if you’d like it spicier. The sauce will thicken more as it cools.
Serve maharagwe hot with cooked rice, ugali (recipe below), or with the flatbread of your choice (naan, pita, chapati, roti, tortillas, etc.) to scoop up the beans.