def copy_with(self, **kwargs):
attrs = {}<EOL>for key, descriptor in self.__class__.__dict__.items():<EOL><INDENT>if isinstance(descriptor, ReadOnlyAttribute):<EOL><INDENT>attrs[key] = descriptor.__get__(self)<EOL><DEDENT><DEDENT>for key in kwargs:<EOL><INDENT>if key not in attrs:<EOL><INDENT>raise TypeError("<STR_LIT>" % key)<EOL><DEDENT><DEDENT>attrs.update(kwargs)<EOL>return self.__class__(**attrs)<EOL>
Return a copy with (a few) changed attributes

           The keyword arguments are the attributes to be replaced by new
           values. All other attributes are copied (or referenced) from the
           original object. This only works if the constructor takes all
           (read-only) attributes as arguments.