1. Pre-heat the oven to 180°C.
2. In a heavy based 9-10 inch frying pan with an ovenproof handle make a dry caramel and then add the butter. Add the onions, cut side down, and the fennel, thyme and season. Cook over a medium heat, cook for 10 minutes or until caramelised, then add the thyme and cover with foil and bake for 10 minutes to soften the onions. Allow it to cool.
3. Roll the pastry to a circle roughly the same size as the pan.
4. Drape over the pan and gently tuck in the edges around the onions.
5. Prick it in a couple of place and bake for 20 minutes, until it’s golden and crispy.
6. Carefully turn it out onto a plate and scatter with the walnuts and cheese and carefully flip it back into the frying pan and return the pan to the hob for a minute, until the cheese has melted.
7. Turn it out onto your serving plate, garnish with some thyme and serve.