def METHOD_NAME(sketches_dict, output):
    """Convert dict of JSON sketches to query hdf5 database"""
    qNames = []
    queryDB = h5py.File(os.path.join(output, os.path.basename(output) + '.h5'), 'w')
    sketches = queryDB.create_group("sketches")
    for top_key, top_value in sketches_dict.items():
        qNames.append(top_key)
        kmers = []
        dists = []
        if type(top_value) == str:
            sketch_dict = json.loads(top_value)
        else:
            sketch_dict = top_value
        sketch_props = sketches.create_group(top_key)
        for key, value in sketch_dict.items():
            try:
                kmers.append(int(key))
                dists.append(np.array(value, dtype='uint64'))
            except (TypeError, ValueError):
                if key == "version":
                    sketches.attrs['sketch_version'] = value
                elif key == "codon_phased":
                    sketches.attrs['codon_phased'] = value
                elif key == "densified":
                    pass
                elif key == "bases":
                    sketch_props.attrs['base_freq'] = value
                elif key == "bbits":
                    sketch_props.attrs['bbits'] = value
                elif key == "length":
                    sketch_props.attrs['length'] = value
                elif key == "missing_bases":
                    sketch_props.attrs['missing_bases'] = value
                elif key == "sketchsize64":
                    sketch_props.attrs['sketchsize64'] = value
                elif key == "species":
                    pass
                else:
                    sys.stderr.write(key + " not recognised")
        sketch_props.attrs['kmers'] = kmers
        for k_index in range(len(kmers)):
            k_spec = sketch_props.create_dataset(str(kmers[k_index]), data=dists[k_index], dtype='uint64')
            k_spec.attrs['kmer-size'] = kmers[k_index]
    queryDB.close()
    return qNames