mirror/rotate quaternion?

Hi everyone!

im working on a game. and i've stumbled upon kind of a strange bug. i have an object in space, and a camera that's supposed to be following it. positioning and all goes well. but the rotation is pointing the exact wrong way, so i need a way to turn it around 180 degrees on either its (local) x or y axis, but not on its z axis(which would turn the camera upside down). i really dont know this kind of math well, so i apologize in advance for being a bit unclear, if there are any questions i'll happily answer them