.. versionadded:: 2015.8.0

    Convert an object to a dictionary

def object_to_dict(obj):
    '''
    .. versionadded:: 2015.8.0

    Convert an object to a dictionary
    '''
    if isinstance(obj, list) or isinstance(obj, tuple):
        ret = []
        for item in obj:
            ret.append(object_to_dict(item))
    elif hasattr(obj, '__dict__'):
        ret = {}
        for item in obj.__dict__:
            if item.startswith('_'):
                continue
            ret[item] = object_to_dict(obj.__dict__[item])
    else:
        ret = obj
    return ret