def set(self, new_fields, subset=None):
for name in new_fields:<EOL><INDENT>if name not in self._fields and (subset is None or name in subset):<EOL><INDENT>raise ValueError("<STR_LIT>" % name)<EOL><DEDENT><DEDENT>if subset is not None:<EOL><INDENT>for name in subset:<EOL><INDENT>if name not in self._fields:<EOL><INDENT>raise ValueError("<STR_LIT>" % name)<EOL><DEDENT>if name not in new_fields:<EOL><INDENT>raise ValueError("<STR_LIT>" % name)<EOL><DEDENT><DEDENT><DEDENT>if subset is None:<EOL><INDENT>if len(new_fields) != len(self._fields):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>for name, attr in self._fields.items():<EOL><INDENT>if name in subset:<EOL><INDENT>attr.set(new_fields[name])<EOL><DEDENT><DEDENT>
Assign the registered fields based on a dictionary

           Argument:
            | ``new_fields``  --  the dictionary with the data to be assigned to
                                  the attributes

           Optional argument:
            | ``subset``  --  a list of names to restrict the fields that are
                              effectively overwritten