def _set_options(self, options):
if not options:<EOL><INDENT>return self.options.copy()<EOL><DEDENT>options = options.copy()<EOL>if '<STR_LIT>' in options:<EOL><INDENT>self.set_magic(options['<STR_LIT>'])<EOL>del(options['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in options:<EOL><INDENT>flags = options['<STR_LIT>']<EOL>del(options['<STR_LIT>'])<EOL>for key, value in flags.iteritems():<EOL><INDENT>if not isinstance(value, bool):<EOL><INDENT>raise TypeError('<STR_LIT>' % key)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>flags = self.options['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:info>' in options:<EOL><INDENT>del(options['<STR_LIT:info>'])<EOL><DEDENT>for key, value in options.iteritems():<EOL><INDENT>if not isinstance(value, int):<EOL><INDENT>raise TypeError('<STR_LIT>' % key)<EOL><DEDENT>if value < <NUM_LIT:0> or value > <NUM_LIT:255>:<EOL><INDENT>raise ValueError('<STR_LIT>' % key)<EOL><DEDENT><DEDENT>new_options = self.options.copy()<EOL>new_options.update(options)<EOL>new_options['<STR_LIT>'].update(flags)<EOL>return new_options<EOL>
Private function for setting options used for sealing