def flag_autos(flags, ubl):
    """
    Flags auto-correlations

    Parameters
    ----------
    flags : :class:`numpy.ndarray`
        Flags corresponding to visibility data
        of shape :code:`(bl, corr, time, chan)`
    ubl : :class:`numpy.ndarray`
        unique baseline pairs corresponding to row (blindx, a1indx, a2indx)
        of shape :code:`(bl, 3)`

    Returns
    -------
    out_flags : ndarray, bool
        Flags corresponding to `data`
    """
    ubl = ubl[0]
    if flags.shape[0] != ubl.shape[0]:
        raise ValueError('flag and ubl shape mismatch %s != %s' % (flags.
            shape[2], ubl.shape[0]))
    out_flags = flags.copy()
    bl_sel = ubl[:, (1)] == ubl[:, (2)]
    out_flags[(bl_sel), :, :, :] = True
    return out_flags
