gSeaGen: the KM3NeT GENIE-based code for neutrino telescopes