def convert_to_dict(obj, ident=0, limit_ident=6):
    ident += 1
    if type(obj) in primitive:
        return obj
    if isinstance(obj, inspect.types.InstanceType) or \
            (type(obj) not in (list, tuple, dict)):
        if limit_ident <= ident:
            try:
                obj = obj.convert_to_dict()
            except AttributeError:
                try:
                    t = obj.__dict__
                    t['_type_class'] = str(obj.__class__)
                    obj = t
                except AttributeError:
                    return str(obj.__class__ if hasattr(obj, '__class__')
                               else type(obj))
        else:
            return str(obj.__class__ if hasattr(obj, '__class__')
                       else type(obj))
    if type(obj) is dict:
        res = {}
        for item in obj:
            if ident <= limit_ident:
                res[item] = convert_to_dict(obj[item], ident)
            else:
                res[item] = str(obj[item])
        return res
    if type(obj) in (list, tuple):
        res = []
        for item in obj:
            if ident <= limit_ident:
                res.append(convert_to_dict(item, ident))
            else:
                res.append(str(item))
        return res if type(obj) is list else tuple(res)
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/utils.py/convert_to_dict/swapped operands of `<=`