@staticmethod
def _write_h5_dict(h5_group, variables):
    """Writes a dictionary to a HDF5 file.

        The dictionary can store strings, which are represented as HDF5
        attributes, and lists of strings, which are represented as attributes of
        HDF5 subgroups.

        :type h5_group: h5py.Group
        :param h5_group: The HD5 group that will store a dictionary of strings
                         in its attributes

        :type variables: dict
        :param variables: a dictionary that may contain strings and lists of strings
        """
    for variable, values in variables.items():
        if isinstance(values, list):
            h5_values = h5_group.require_group(variable)
            for value_id, value in enumerate(values):
                h5_values.attrs[str(value_id)] = value
        else:
            h5_group.attrs[variable] = values
