def _format_metadata_attribute(value):
    """Format a value for writing to HDF5 as a `h5py.Dataset` attribute
    """
    if (value is None or
            (isinstance(value, Index) and value.regular)):
        raise IgnoredAttribute

    # map type to something HDF5 can handle
    for typekey, func in ATTR_TYPE_MAP.items():
        if issubclass(type(value), typekey):
            return func(value)
    return value
Format a value for writing to HDF5 as a `h5py.Dataset` attribute