def object_to_dict(obj, list_depth=1):
 d = {}
 for (k, v) in dict(obj).items():
  if hasattr(v, '__keylist__'):
   d[k] = object_to_dict(v, list_depth=list_depth)
  elif isinstance(v, list):
   d[k] = []
   used = 0
   for item in v:
    used = (used + 1)
    if (used > list_depth):
     break
    if hasattr(item, '__keylist__'):
     d[k].append(object_to_dict(item, list_depth=list_depth))
    else:
     d[k].append(item)
  else:
   d[k] = v
 return d

def object_to_dict ( obj , list_depth = 1 ) : d = { } for ( k , v ) in dict ( obj ) . items ( ) : if hasattr ( v , '__keylist__' ) : d [ k ] = object_to_dict ( v , list_depth = list_depth ) elif isinstance ( v , list ) : d [ k ] = [ ] used = 0 for item in v : used = ( used + 1 ) if ( used > list_depth ) : break if hasattr ( item , '__keylist__' ) : d [ k ] . append ( object_to_dict ( item , list_depth = list_depth ) ) else : d [ k ] . append ( item ) else : d [ k ] = v return d
convert suds object into serializable format .