def fix_return(node):
 if isinstance(node, datetime.datetime):
  node_value = str(node)
 elif isinstance(node, list):
  node_value = [fix_return(item) for item in node]
 elif isinstance(node, dict):
  node_value = dict([(item, fix_return(node[item])) for item in node.keys()])
 else:
  node_value = node
 return node_value

def fix_return ( node ) : if isinstance ( node , datetime . datetime ) : node_value = str ( node ) elif isinstance ( node , list ) : node_value = [ fix_return ( item ) for item in node ] elif isinstance ( node , dict ) : node_value = dict ( [ ( item , fix_return ( node [ item ] ) ) for item in node . keys ( ) ] ) else : node_value = node return node_value
fixup returned dictionary .