def get_psf_ellip(catalog):
    """
    This utility gets the PSF ellipticity (distortion) from a data or
    sims catalog.
    It does not impose flag cuts, but rather assumes that has already been done
    """
    if 'shape_sdss_psf' in catalog.dtype.names:
        psf_mxx, psf_myy, psf_mxy = catalog['shape_sdss_psf'].T
    else:
        psf_mxx = catalog['ishape_sdss_psf_ixx']
        psf_myy = catalog['ishape_sdss_psf_iyy']
        psf_mxy = catalog['ishape_sdss_psf_ixy']
    return (psf_mxx - psf_myy) / (psf_mxx + psf_myy), 2. * \
        psf_mxy / (psf_mxx + psf_myy)