An endophyte is an endosymbiont, often a bacterium or fungus, that lives within a plant for at least part of its life cycle without causing apparent disease .