def from_tree(expr, namespace=None):
 if isinstance(expr, dict):
  (op, args) = (expr[u'op'], expr[u'args'])
  if (op == u'slice'):
   return expr_utils._slice(*[from_tree(arg, namespace) for arg in args])
  if hasattr(blaze.expr, op):
   cls = getattr(blaze.expr, op)
  else:
   cls = expression_from_name(op)
  if (cls is Symbol):
   cls = symbol
  children = [from_tree(arg, namespace) for arg in args]
  return cls(*children)
 elif isinstance(expr, (list, tuple)):
  return tuple((from_tree(arg, namespace) for arg in expr))
 if (namespace and (expr in namespace)):
  return namespace[expr]
 else:
  return expr

def from_tree ( expr , namespace = None ) : if isinstance ( expr , dict ) : ( op , args ) = ( expr [ u'op' ] , expr [ u'args' ] ) if ( op == u'slice' ) : return expr_utils . _slice ( * [ from_tree ( arg , namespace ) for arg in args ] ) if hasattr ( blaze . expr , op ) : cls = getattr ( blaze . expr , op ) else : cls = expression_from_name ( op ) if ( cls is Symbol ) : cls = symbol children = [ from_tree ( arg , namespace ) for arg in args ] return cls ( * children ) elif isinstance ( expr , ( list , tuple ) ) : return tuple ( ( from_tree ( arg , namespace ) for arg in expr ) ) if ( namespace and ( expr in namespace ) ) : return namespace [ expr ] else : return expr
convert core data structures to blaze expression core data structure representations created by to_tree are converted back into blaze expressions .