Leak through rear tail light, how to seal?

I recently acquired a 2005 Nissan Micra and started to notice when it rained the boot would get wet and fill the spare tyre well with water, so I got the hose out to try and trace where the water was coming in. By doing this I found that the water was coming in from behind the rear tail light (I will attach a picture). I'm not that knowledgeable on cars so excuse me if I use the wrong terminology - there seems to be some foam around the component which soaks up water and drips it in to the car. Is there a way I can somehow seal this at home without a costly trip to a garage?

Link to picture:

Many thanks,