def _crawl_attribute(this_data, this_attr):
 if isinstance(this_data, list):
  t_list = []
  for d in this_data:
   t_list.append(_crawl_attribute(d, this_attr))
  return t_list
 elif isinstance(this_attr, dict):
  t_dict = {}
  for k in this_attr.keys():
   if hasattr(this_data, k):
    t_dict[k] = _crawl_attribute(getattr(this_data, k, None), this_attr[k])
  return t_dict
 elif isinstance(this_attr, list):
  this_dict = {}
  for l in this_attr:
   this_dict = dictupdate.update(this_dict, _crawl_attribute(this_data, l))
  return this_dict
 else:
  return {this_attr: _recurse_config_to_dict(getattr(this_data, this_attr, None))}

def _crawl_attribute ( this_data , this_attr ) : if isinstance ( this_data , list ) : t_list = [ ] for d in this_data : t_list . append ( _crawl_attribute ( d , this_attr ) ) return t_list elif isinstance ( this_attr , dict ) : t_dict = { } for k in this_attr . keys ( ) : if hasattr ( this_data , k ) : t_dict [ k ] = _crawl_attribute ( getattr ( this_data , k , None ) , this_attr [ k ] ) return t_dict elif isinstance ( this_attr , list ) : this_dict = { } for l in this_attr : this_dict = dictupdate . update ( this_dict , _crawl_attribute ( this_data , l ) ) return this_dict else : return { this_attr : _recurse_config_to_dict ( getattr ( this_data , this_attr , None ) ) }
helper function to crawl an attribute specified for retrieval .