Saves the selected field *attributes* for each :class:`Field` *nested*
        in the `Container` to an ``.ini`` *file*.

        :param str file: name and location of the ``.ini`` *file*.
        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword str section: section in the ``.ini`` file to look for the
            :class:`Field` values of the `Container`. If no *section* is
            specified the class name of the instance is used.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            `Container` saves their referenced :attr:`~Pointer.data` object
            field attributes as well (chained method call).

        Example:

        >>> class Foo(Structure):
        ...     def __init__(self):
        ...         super().__init__()
        ...         self.stream = Stream()
        ...         self.float = Float()
        ...         self.structure = Structure()
        ...         self.structure.decimal = Decimal(8)
        ...         self.array = Array(Byte, 3)
        ...         self.pointer = Pointer()
        >>> foo = Foo()
        >>> foo.to_list(nested=True)
        [('Foo.stream', ''),
         ('Foo.float', 0.0),
         ('Foo.structure.decimal', 0),
         ('Foo.array[0]', '0x0'),
         ('Foo.array[1]', '0x0'),
         ('Foo.array[2]', '0x0'),
         ('Foo.pointer', '0x0')]
        >>> foo.to_json(nested=True)
        '{"stream": "",
          "float": 0.0,
          "structure": {"decimal": 0},
          "array": ["0x0", "0x0", "0x0"],
          "pointer": {"value": "0x0",
                      "data": null}}'
        >>> foo.save('foo.ini')

        File `foo.ini`:

        .. code-block:: ini

            [Foo]
            stream =
            float = 0.0
            structure.decimal = 0
            array[0] = 0x0
            array[1] = 0x0
            array[2] = 0x0
            pointer = 0x0

def save(self, file, *attributes, **options):
        """ Saves the selected field *attributes* for each :class:`Field` *nested*
        in the `Container` to an ``.ini`` *file*.

        :param str file: name and location of the ``.ini`` *file*.
        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword str section: section in the ``.ini`` file to look for the
            :class:`Field` values of the `Container`. If no *section* is
            specified the class name of the instance is used.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            `Container` saves their referenced :attr:`~Pointer.data` object
            field attributes as well (chained method call).

        Example:

        >>> class Foo(Structure):
        ...     def __init__(self):
        ...         super().__init__()
        ...         self.stream = Stream()
        ...         self.float = Float()
        ...         self.structure = Structure()
        ...         self.structure.decimal = Decimal(8)
        ...         self.array = Array(Byte, 3)
        ...         self.pointer = Pointer()
        >>> foo = Foo()
        >>> foo.to_list(nested=True)
        [('Foo.stream', ''),
         ('Foo.float', 0.0),
         ('Foo.structure.decimal', 0),
         ('Foo.array[0]', '0x0'),
         ('Foo.array[1]', '0x0'),
         ('Foo.array[2]', '0x0'),
         ('Foo.pointer', '0x0')]
        >>> foo.to_json(nested=True)
        '{"stream": "",
          "float": 0.0,
          "structure": {"decimal": 0},
          "array": ["0x0", "0x0", "0x0"],
          "pointer": {"value": "0x0",
                      "data": null}}'
        >>> foo.save('foo.ini')

        File `foo.ini`:

        .. code-block:: ini

            [Foo]
            stream =
            float = 0.0
            structure.decimal = 0
            array[0] = 0x0
            array[1] = 0x0
            array[2] = 0x0
            pointer = 0x0
        """
        options['save'] = True
        parser = ConfigParser()
        parser.read_dict(self.to_dict(*attributes, **options))
        with open(file, 'w') as file_handle:
            parser.write(file_handle)
        file_handle.close()