Bremsstrahlung from thick targets and a diagnostic for electron energy distributions