Staying slim has never been easy for me.

In my 20s, I may have been a size 10 (I'm 5 ft 8 in), but after having children I was a curvy 12, and then after hitting the perimenopause a few years ago (I'm now 53), I've gained more than 2 st, with my BMI squarely into 'overweight' range.

Dieting no longer seems to work, nor did sessions with a pushy personal trainer.

When I couldn't fit into a size 16 Primark frock at Christmas, I was mortified. I put this down to work, stress, hormones and a bad back that stopped me exercising.

But now, thanks to a new test, I know there could be another reason: the calorie-conserving bacteria in my gut

Scroll down for video

When Leah Hardy (pictured) could not fit into a size 16 Primark frock at Christmas, she had put this down to work, stress, hormones and a bad back that stopped her exercising

We all have trillions of different microbes in our guts. The latest thinking is that this microscopic community, known as the microbiome, acts like an organ in the body, performing various vital functions.

A healthy, balanced microbiome helps us break down foods, protects us from infection, trains our immune system and manufactures vitamins, such as K and B12.

It also plays a role in regulating blood sugar and metabolism, and sends signals to our brain that can affect mood, anxiety and appetite.

A bad diet, stress, alcohol and lack of sleep can upset your microbiome, creating imbalances that are increasingly being linked to conditions ranging from irritable bowel syndrome (IBS) to diabetes, high blood pressure, depression — and, yes, obesity.

I know about my weight-gaining bacteria because of a new test that analyses your microbiome.

The company behind the test, Map My Gut, was recently launched by Tim Spector, a professor of genetic epidemiology at King's College London.

The founder of the UK Twins Registry and the British Gut Project, Professor Spector has a database of more than 14,000 people whose microbiome has been tested and he's at the forefront of the science on how our gut bacteria affect our health.

To do the test, you get a pack with a plastic pot, a spatula, latex gloves and a paper 'poo-catcher'.

Once you have collected your sample, it is sent to a specialist laboratory, which uses DNA technology to identify the bacteria in your gut.

Thanks to a new test, Leah hardy (pictured) knows there could be another reason for her weight gain: the calorie-conserving bacteria in her gut

Around four weeks later, you receive a personalised report from your assigned 'nutrition expert'.

This won't be some glossy-haired food blogger with a diploma from a weekend workshop: Professor Spector says the nutrition experts are doctors, scientists, dietitians or nutritional therapists (who must have completed nutrition training to at least degree-equivalent level).

My nutrition expert, Miguel Toribio-Mateas, has a degree in nutritional medicine, a masters degree in clinical neuroscience and is completing a doctorate in cognitive ageing.

He's also a clinical neuroscientist and head of practitioner education for Map My Gut — I seem to have hit the jackpot.

The report includes an overview of your microbiome, showing how it compares with the average microbiome (based on that database of 14,000 people), as well as rating your general gut health and giving basic dietary recommendations specific to your needs. The whole package — test included — costs £300.

Map My Gut is a new test that analyses your microbiome, and was recently launched by Tim Spector, a professor of genetic epidemiology at King's College London

Given that the science is so new and fast-changing, some academics think it's too early to offer personalised diet recommendations based on our microbiome.

Professor Spector, as you might expect, disagrees. He says there is proven science we can put to use now.

'We know for example, that the more diverse their microbiome, the healthier people tend to be,' he says.

'But modern diets and lifestyles work against this diversity and, from studies, we can see that the variety of microbes in our bodies is roughly 30 per cent lower than it was 50 years ago, which may contribute to the obesity epidemic.'

I expected to learn that my microbiome was in good shape — I'd prided myself on my varied and, I thought, healthy diet: I like kale and lentils, blueberries and live yoghurt.

My husband has more traditional tastes, so we'll regularly eat meaty dishes such as chillis or a roast, and drink a couple of glasses of wine most nights. But I never have sweets or fizzy drinks.

Sadly, if a healthy microbiome is a lush and varied garden, it turns out mine is more of a dusty backyard: my bacterial diversity isn't 'bad', but it's below average, with low levels of many types of bacteria.

Illustration of a human gut. Map My Gut includes an overview of your microbiome, showing how it compares with the average microbiome based on a database of 14,000 people

And, worse, my composition of gut bacteria means my body is ultra-efficient at absorbing every scrap of energy from food, conserving it as fat.

This is because I have high levels of ruminococcaceae, bacteria linked to obesity and gut disorders, which indicate a high-carb diet.

And I have high levels of rikenellaceae, also associated with being overweight and linked to a high-fat diet.

Add to this my low levels of the anti-inflammatory bacteria akkermansia (just 1.1 per cent, compared with the average of 9 to 12 per cent) — which improves blood sugar control and which Professor Spector's latest research shows is linked to a lower risk of obesity and accumulating dangerous visceral fat around your organs — and frankly, I am truly a fat magnet.

I am also very low in christensenellaceae — dubbed the 'skinny' bacteria because the more you have, the leaner you are.

Professor Spector's twin studies showed that people with more of this bacteria had a significantly lower BMI (body mass index) and found it hard to gain weight.

Ruminococcaceae, bacteria linked to obesity and gut disorders, which indicate a high-carb diet. A high level of this bacteria means your body is ultra-efficient at absorbing energy

Most people have some of this microbe — the average is just over 2.5 per cent — but, to my horror, it makes up just 0.2 per cent of my microbiome.

This, says Miguel, could explain a lot about my battle with my weight.

Then he tells me most gut microbes belong to one of two 'families' — bacteroidetes and firmicutes.

Ideally, firmicutes comprise no more than half of the mix.

But I have two-thirds firmicutes and only one-third bacteroidetes — and firmicutes are 'particularly efficient' at extracting calories from food, especially from fat.

It's not just my fattening bacteria that's the problem.

Only 1.2 per cent of my microbiome is the healthy bacteria F. prausnitzii (the UK average is 9 to 18 per cent), a marker of gut health linked to a lower risk of auto-immune disorders and allergic reactions.

Could this help explain why I'm struggling to get my asthma under control?

It also, apparently, puts me at risk of IBS.

A low level of the bacteria F. prausnitzii is linked to a higher risk of auto-immune disorders such as asthma, as well as allergic reactions

In addition, I have no detectable bacteroides fragilis, a powerful anti-inflammatory microbe.

Inflammation has been linked to most health problems, from heart disease to depression.

'It's not uncommon to have zero amounts of some common healthy bacteria,' Miguel reassures me. 'Few people have an 'ideal' microbiome.'

But, a little upset by my results, I ask if stress or antibiotics could have played a part — I have a child with complex health issues and, last year, had two courses of antibiotics for dental infections. The answer is yes.

You can improve your microbiome diversity in weeks, by altering your diet and lifestyle

Studies show stress hormones can affect the gut blood supply and disturb the gut microbial balance.

'And most common antibiotics disrupt around a third of the normal friendly inhabitants of the gut,' says Professor Spector.

'They often recover quickly, but in many people, this can take weeks or months.'

The good news is you can improve your microbiome diversity in weeks, by altering your diet and lifestyle.

The answer for me is to shun sugar and processed carbs and adopt a high-fibre, fairly low-fat diet.

What I need are lots of beans, along with chickpeas, peas and lentils, which will increase the amount of bacteroidetes in my gut.

Eating lots of beans, along with chickpeas, peas and lentils is sure to increase the amount of bacteroidetes in your gut

As my microbes absorb calories from fat, I should avoid fatty foods, says Miguel, except for extra-virgin olive oil — the darker, more bitter, the better, as it's rich in polyphenols, compounds on which gut bacteria thrive.

I should also include small amounts of unpasteurised cheese, such as Brie de Meaux, pecorino and manchego, and full-fat yoghurt, rich sources of healthy microbes.

Another way of introducing good bugs directly into my gut is to drink kefir (fermented milk) every day and eat fermented foods, such as sauerkraut, Korean spicy pickle kimchi, plus balsamic and cider vinegar and tamari sauce — fermented foods containing good bacteria.

I need two portions of fruit a day, ideally berries, which contain polyphenols, and red grapes, as research suggests these help boost levels of (obesity-fighting) akkermansia, and at least five portions of veg a day — especially artichokes, leeks, onions and garlic, which are rich in inulin, a soluble fibre loved by anti-inflammatory bacteria.

And I should add more bacteria-feeding spices, such as black pepper, turmeric and cumin, and swap red meat for fish and nuts.

Bacteria-feeding spices include traditional Indian ones such as turmeric and cumin. Experts also recommend to swap red meat for fish and nuts

Red meat, particularly processed meat, can worsen gut microbe balance, says Professor Spector. Nuts have fibre and polyphenols associated with weight loss.

While a small glass of red wine a few times a week is fine, too much alcohol is toxic to good bacteria.

Other big no-nos are foods with additives, particularly emulsifiers and artificial sweeteners, and trans fats (hardened vegetable fats found in margarine and some cakes and biscuits), so that means using butter instead of synthetic spreads.

Most importantly, I should aim for a more varied diet. Professor Spector suggests everyone eats at least 20 different foods a week.

I should include as many colours as possible, which means you're getting a variety of polyphenols.

What I really want to know is how to get more of the 'skinny' christensenellaceae bacteria. The bad news is this is one of a few bacteria strongly inherited via your genes.

While a small glass of red wine a few times a week is fine, too much alcohol is toxic to good strains of bacteria

But many species of skinny bacteria thrive on plant foods, and there's some evidence resistant starch is particularly good at feeding them — this forms when you cook starchy food, such as potatoes, then leave them to go cold before eating.

It's also found in unripe bananas. I'm also trying to leave a 12 to 16- hour gap between my evening meal and breakfast.

As Professor Spector explains: 'Fasting or meal skipping helps akkermansia and F. prausnitzii, and skipping breakfast or having fewer meals, even if you eat the same amount, aids weight loss.'

Since starting my gut-friendly diet two weeks ago, I have eaten a billion beans and my body weight in red grapes, artichokes, celeriac, yoghurt, blueberries, kale and kefir.

I am, ahem, rather windy, but I do feel better and am far less hungry — and I've lost around 3 lb so far. Watch this space!

MapMyGut.com