def serialize(self, buffer=bytearray(), index=Index(), **options):
        """ Serializes the `Structure` to the byte *buffer* starting at begin
        of the *buffer* or with the given *index* by mapping the
        :attr:`~Field.value` for each :class:`Field` in the `Structure` to the
        byte *buffer* in accordance with the encoding *byte order* for the
        serialization and the encoding :attr:`byte_order` of each :class:`Field`
        in the `Structure`.

        A specific encoding :attr:`~Field.byte_order` of a :class:`Field`
        overrules the encoding *byte order* for the serialization.

        Returns the :class:`Index` of the *buffer* after the last serialized
        :class:`Field` in the `Structure`.

        Optional the serialization of the referenced :attr:`~Pointer.data`
        objects of all :class:`Pointer` fields in the `Structure` can be
        enabled.

        :param bytearray buffer: byte stream.
        :param Index index: current write :class:`Index` within the *buffer*.
        :keyword byte_order: encoding byte order for the serialization.
        :type byte_order: :class:`Byteorder`, :class:`str`
        :keyword bool nested: if ``True`` all :class:`Pointer` fields of a
            `Structure` serialize their referenced :attr:`~Pointer.data` object
            as well (chained method call).
            Each :class:`Pointer` field uses for the serialization of its
            referenced :attr:`~Pointer.data` object its own
            :attr:`~Pointer.bytestream`.
        """
        for item in self.values():
            index = item.serialize(buffer, index, **options)
        return index