# -*- coding: utf-8 -*-

from typing import (
    Any,
    Optional,
    Dict,
    Mapping,
    List,
    Tuple,
    Match,
    Callable,
    Type,
    Sequence,
)

class Klass:
    def __init__(self):
        pass

klass = Klass()

def dict2obj(dictionary):
    klass.__dict__.update(dictionary)
    return klass

class ObjectDict(Dict[str, Any]):
    """Makes a dictionary behave like an object, with attribute-style access."""

    def __getattr__(self, name: str) -> Any:
        try:
            return self[name]
        except KeyError:
            raise AttributeError(name)

    def __setattr__(self, name: str, value: Any) -> None:
        self[name] = value

if __name__ == "__main__":
    d = { 'a': 1, 'b': 2 }
    print(dict2obj(d))