ProSpect: generating spectral energy distributions with complex star formation and metallicity histories