def METHOD_NAME(dataset, output_directory):
    """
    Converts a HDF5 scalar dataset to a yaml and/or json file.
    All attributes will be included in the yaml file.
    :param dataset:
        A HDF5 scalar dataset.
    :param output_directory:
        A filesystem path to the directory that will be the root
        directory for any images extracted.
    :return:
        None, outputs are written directly to disk.
    """
    base_fname = pjoin(output_directory, normpath(dataset.name.strip("/")))
    if dataset.attrs.get("file_format") == "yaml":
        tags = yaml.load(dataset[()], Loader=yaml.FullLoader)
    elif dataset.attrs.get("file_format") == "json":
        tags = {k: v for k, v in dataset.attrs.items()}
        data = dataset[()]
        if isinstance(data, numpy.bytes_):
            data = data.decode("utf-8")
        out_fname_json = "".join([base_fname, ".json"])
        if not exists(dirname(out_fname_json)):
            os.makedirs(dirname(out_fname_json))
        with open(out_fname_json, "w") as src:
            json.dump(json.loads(data), src, cls=JsonEncoder, indent=4)
    else:
        tags = {k: v for k, v in dataset.attrs.items()}
        data = dataset[()]
        if isinstance(data, numpy.bytes_):
            data = data.decode("utf-8")
        tags[basename(dataset.name)] = data
    out_fname_yaml = "".join([base_fname, ".yaml"])
    if not exists(dirname(out_fname_yaml)):
        os.makedirs(dirname(out_fname_yaml))
    with open(out_fname_yaml, "w") as src:
        yaml.dump(tags, src, default_flow_style=False, indent=4)