@staticmethod<EOL><INDENT>def create_property(name, ptype):<DEDENT>
pname = '<STR_LIT:_>' + name<EOL>def getter(self):<EOL><INDENT>if not hasattr(self, pname) and hasattr(self, '<STR_LIT>'.format(self._getter_prefix, pname)):<EOL><INDENT>self['<STR_LIT>'.format(self._getter_prefix, pname)]()<EOL><DEDENT>if not hasattr(self, pname):<EOL><INDENT>raise AttributeError('<STR_LIT>'.format(name))<EOL><DEDENT>return getattr(self, pname)<EOL><DEDENT>def setter(self, obj):<EOL><INDENT>if not isinstance(obj, ptype):<EOL><INDENT>try:<EOL><INDENT>obj = ptype(obj)<EOL><DEDENT>except Exception:<EOL><INDENT>raise TypeError('<STR_LIT>'.format(name, ptype))<EOL><DEDENT><DEDENT>setattr(self, pname, obj)<EOL><DEDENT>def deleter(self):<EOL><INDENT>del self[pname]<EOL><DEDENT>return property(getter, setter, deleter)<EOL>
Creates a custom property with a getter that performs computing
functionality (if available) and raise a type error if setting
with the wrong type.

Note:
    By default, the setter attempts to convert the object to the
    correct type; a type error is raised if this fails.