def write_array_metadata(dataset, array):
for attr in ('<STR_LIT>',) + array._metadata_slots:<EOL><INDENT>try:<EOL><INDENT>value = _format_metadata_attribute(<EOL>getattr(array, '<STR_LIT>' % attr, None))<EOL><DEDENT>except IgnoredAttribute:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>dataset.attrs[attr] = value<EOL><DEDENT>except (TypeError, ValueError, RuntimeError) as exc:<EOL><INDENT>exc.args = ("<STR_LIT>".format(<EOL>attr, type(value).__name__, type(array).__name__, str(exc)))<EOL>raise<EOL><DEDENT><DEDENT>
Write metadata for ``array`` into the `h5py.Dataset`