<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create(cls, skydir, ltc, event_class, event_types, energies, cth_bins=None, ndtheta=500, use_edisp=False, fn=None, nbin=64):
 """Create a PSFModel object. This class can be used to evaluate the exposure-weighted PSF for a source with a given observing profile and energy distribution. Parameters skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` energies : `~numpy.ndarray` Grid of energies at which the PSF will be pre-computed. cth_bins : `~numpy.ndarray` Bin edges in cosine of the inclination angle. use_edisp : bool Generate the PSF model accounting for the influence of energy dispersion. fn : `~fermipy.spectrum.SpectralFunction` Model for the spectral energy distribution of the source. """


        if isinstance(event_types, int):
            event_types = bitmask_to_bits(event_types)

        if fn is None:
            fn = spectrum.PowerLaw([1E-13, -2.0])

        dtheta = np.logspace(-4, 1.75, ndtheta)
        dtheta = np.insert(dtheta, 0, [0])
        log_energies = np.log10(energies)
        egy_bins = 10**utils.center_to_edge(log_energies)

        if cth_bins is None:
            cth_bins = np.array([0.2, 1.0])

        if use_edisp:
            psf = create_wtd_psf(skydir, ltc, event_class, event_types,
                                 dtheta, egy_bins, cth_bins, fn, nbin=nbin)
            wts = calc_counts_edisp(skydir, ltc, event_class, event_types,
                                    egy_bins, cth_bins, fn, nbin=nbin)
        else:
            psf = create_avg_psf(skydir, ltc, event_class, event_types,
                                 dtheta, energies, cth_bins)
            wts = calc_counts(skydir, ltc, event_class, event_types,
                              egy_bins, cth_bins, fn)

        exp = calc_exp(skydir, ltc, event_class, event_types,
                       energies, cth_bins)

        return cls(dtheta, energies, cth_bins, np.squeeze(exp), np.squeeze(psf),
                   np.squeeze(wts))