The function:
The slime layer is an easily removed, diffuse, unorganized layer of extracellular material which surrounds the bacterial cell. It is usually composed of polysaccharides and it may serve to trap nutrients, to aid in cell motility, to bind cells together or to adhere to smooth surfaces.
I'm not sure about the poison attack which I am sorry about, but I hope this helps at least a little!