def METHOD_NAME(group, k, v, m):
    # Add context to exception message when the user writes a dataset that is
    # not representable in HDF5.
    try:
        group[k] = v
        for key, val in m.items():
            group[k].attrs[key] = val
    except TypeError as e:
        raise TypeError("Error writing dataset '{}' of type '{}': {}".format(
            k, type(v), e))