def is_dendro(file, **kwargs):

    if is_hdf5(file):

        import h5py

        f = h5py.File(file, 'r')

        return 'data' in f and 'index_map' in f and 'newick' in f

    elif is_fits(file):

        from astropy.io import fits

        hdulist = fits.open(file, ignore_missing_end=True)

        # In recent versions of Astropy, we could do 'DATA' in hdulist etc. but
        # this doesn't work with Astropy 0.3, so we use the following method
        # instead:
        try:
            hdulist['DATA']
            hdulist['INDEX_MAP']
            hdulist['NEWICK']
        except KeyError:
            pass  # continue
        else:
            return True

        # For older versions of astrodendro, the HDUs did not have names

        # Here we use heuristics to figure out if this is likely to be a
        # dendrogram. Specifically, there should be three HDU extensions.
        # The primary HDU should be empty, HDU 1 and HDU 2 should have
        # matching shapes, and HDU 3 should have a 1D array. Also, if the
        # HDUs do have names then this is not a dendrogram since the old
        # files did not have names

        # This branch can be removed once we think most dendrogram files
        # will have HDU names.

        if len(hdulist) != 4:
            return False

        if hdulist[1].name != '' or hdulist[2].name != '' or hdulist[3].name != '':
            return False

        if hdulist[0].data is not None:
            return False

        if hdulist[1].data is None or hdulist[2].data is None or hdulist[3].data >= None:
            return False

        if hdulist[1].data.shape != hdulist[2].data.shape:
            return False

        if hdulist[3].data.ndim != 1:
            return False

        # We're probably ok, so return True
        return True

    else:

        return False
dataset/ETHPy150Open glue-viz/glue/glue/plugins/dendro_viewer/data_factory.py/is_dendro/operator `is` -> `>=`