def _get_error_details(data, default_code=None):
 if isinstance(data, list):
  ret = [_get_error_details(item, default_code) for item in data]
  if isinstance(data, ReturnList):
   return ReturnList(ret, serializer=data.serializer)
  return ret
 elif isinstance(data, dict):
  ret = {key: _get_error_details(value, default_code) for (key, value) in data.items()}
  if isinstance(data, ReturnDict):
   return ReturnDict(ret, serializer=data.serializer)
  return ret
 text = force_text(data)
 code = getattr(data, u'code', default_code)
 return ErrorDetail(text, code)

def _get_error_details ( data , default_code = None ) : if isinstance ( data , list ) : ret = [ _get_error_details ( item , default_code ) for item in data ] if isinstance ( data , ReturnList ) : return ReturnList ( ret , serializer = data . serializer ) return ret elif isinstance ( data , dict ) : ret = { key : _get_error_details ( value , default_code ) for ( key , value ) in data . items ( ) } if isinstance ( data , ReturnDict ) : return ReturnDict ( ret , serializer = data . serializer ) return ret text = force_text ( data ) code = getattr ( data , u'code' , default_code ) return ErrorDetail ( text , code )
descend into a nested data structure .