
from __future__ import absolute_import, unicode_literals, print_function, division

import sys

if sys.version_info[0] < 3:
    PY3, Unicode, Bytes = False, unicode, str
else:
    PY3, Unicode, Bytes = True, str, bytes

to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v, Unicode) else v
to_unicode = lambda v, e="utf-8": v.decode(e) if isinstance(v, Bytes) else v
to_str = to_unicode if PY3 else to_bytes


from __future__ import absolute_import, unicode_literals, print_function, division

import sys

if sys.version_info[0] < 3:
    PY3, Unicode, Bytes = False, unicode, str
else:
    PY3, Unicode, Bytes = True, str, bytes

to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v, Unicode) else v
to_unicode = lambda v, e="utf-8": v.decode(e) if isinstance(v, Bytes) else v
to_str = to_unicode if PY3 else to_bytes


class ObjectDict(dict):
    def __setattr__(self, name, value):
        self[name] = value

    def __getattr__(self, name):
        try:
            return self[name]
        except KeyError:
            raise AttributeError("'%s' object has no attribute '%s'" % (
                                 self.__class__.__name__, name))

Add the python example ObjectDict
Add the python example ObjectDict

  
  from __future__ import absolute_import, unicode_literals, print_function, division
  
  import sys
  
  if sys.version_info[0] < 3:
      PY3, Unicode, Bytes = False, unicode, str
  else:
      PY3, Unicode, Bytes = True, str, bytes
  
  to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v, Unicode) else v
  to_unicode = lambda v, e="utf-8": v.decode(e) if isinstance(v, Bytes) else v
  to_str = to_unicode if PY3 else to_bytes
  
+ 
+ class ObjectDict(dict):
+     def __setattr__(self, name, value):
+         self[name] = value
+ 
+     def __getattr__(self, name):
+         try:
+             return self[name]
+         except KeyError:
+             raise AttributeError("'%s' object has no attribute '%s'" % (
+                                  self.__class__.__name__, name))
+ 
Add the python example ObjectDict
## Code Before:

from __future__ import absolute_import, unicode_literals, print_function, division

import sys

if sys.version_info[0] < 3:
    PY3, Unicode, Bytes = False, unicode, str
else:
    PY3, Unicode, Bytes = True, str, bytes

to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v, Unicode) else v
to_unicode = lambda v, e="utf-8": v.decode(e) if isinstance(v, Bytes) else v
to_str = to_unicode if PY3 else to_bytes

## Instruction:
Add the python example ObjectDict
## Code After:

from __future__ import absolute_import, unicode_literals, print_function, division

import sys

if sys.version_info[0] < 3:
    PY3, Unicode, Bytes = False, unicode, str
else:
    PY3, Unicode, Bytes = True, str, bytes

to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v, Unicode) else v
to_unicode = lambda v, e="utf-8": v.decode(e) if isinstance(v, Bytes) else v
to_str = to_unicode if PY3 else to_bytes


class ObjectDict(dict):
    def __setattr__(self, name, value):
        self[name] = value

    def __getattr__(self, name):
        try:
            return self[name]
        except KeyError:
            raise AttributeError("'%s' object has no attribute '%s'" % (
                                 self.__class__.__name__, name))
