def result_from_tuple(r, app=None):
 app = app_or_default(app)
 Result = app.AsyncResult
 if (not isinstance(r, ResultBase)):
  (res, nodes) = r
  if nodes:
   return app.GroupResult(res, [result_from_tuple(child, app) for child in nodes])
  (id, parent) = (res if isinstance(res, (list, tuple)) else (res, None))
  if parent:
   parent = result_from_tuple(parent, app)
  return Result(id, parent=parent)
 return r

def result_from_tuple ( r , app = None ) : app = app_or_default ( app ) Result = app . AsyncResult if ( not isinstance ( r , ResultBase ) ) : ( res , nodes ) = r if nodes : return app . GroupResult ( res , [ result_from_tuple ( child , app ) for child in nodes ] ) ( id , parent ) = ( res if isinstance ( res , ( list , tuple ) ) else ( res , None ) ) if parent : parent = result_from_tuple ( parent , app ) return Result ( id , parent = parent ) return r
deserialize result from tuple .