def dict2obj(d):
    """Convert a dict to an object.

    Args:
        d (dict): Dict to convert.

    Returns:
        object: Converted object.
    """
    if isinstance(d, list):
        d = [dict2obj(x) for x in d]
    if not isinstance(d, dict):
        return d

    class C(object):
        pass

    o = C()
    for k in d:
        o.__dict__[k] = dict2obj(d[k])
    return o