foo(TermStr) :-
    Term = 'FileInput'{path:'/tmp/pykythe_test/SUBST/home/peter/src/pykythe/test_data/imports_dir1/i1.py',scope_bindings:dict{'III':none,i3:none,i3_b:none,i4:none,i4_b:none,i4_loc:none,iii:none,loc:none},stmts:['AssignExprStmt'{expr:'StringNode'{astns:['Astn'{end:171,start:134,value:'"pykythe/test_data/imports_dir/i1.py"'}]},left:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.loc',name:'Astn'{end:131,start:128,value:loc}}},'ExprStmt'{expr:'AtomCallNode'{args:['OpNode'{args:['OpNode'{args:['OpNode'{args:['StringNode'{astns:['Astn'{end:190,start:179,value:'"Entering "'}]},'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.loc',name:'Astn'{end:196,start:193,value:loc}}],op_astns:['Astn'{end:192,start:191,value: (+)}]},'StringNode'{astns:['Astn'{end:206,start:199,value:'" ... "'}]}],op_astns:['Astn'{end:198,start:197,value: (+)}]},'NameRefUnknown'{fqn_scope:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1',name:'Astn'{end:217,start:209,value:'__file__'}}],op_astns:['Astn'{end:208,start:207,value: (+)}]}],atom:'NameRefUnknown'{fqn_scope:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1',name:'Astn'{end:178,start:173,value:print}}}},'ImportFromStmt'{from_dots:['ImportDotNode'{dot:'Astn'{end:226,start:225,value: ('.')}}],import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3',name:'Astn'{end:236,start:234,value:i3}},name:'NameBareNode'{name:'Astn'{end:236,start:234,value:i3}}}]}},'ImportFromStmt'{from_dots:[],from_name:'DottedNameNode'{items:['NameBareNode'{name:'Astn'{end:250,start:243,value:pykythe}},'NameBareNode'{name:'Astn'{end:260,start:251,value:test_data}},'NameBareNode'{name:'Astn'{end:273,start:261,value:imports_dir1}}]},import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3_b',name:'Astn'{end:291,start:287,value:i3_b}},name:'NameBareNode'{name:'Astn'{end:283,start:281,value:i3}}}]}},'AssertStmt'{items:['OpNode'{args:['NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3',name:'Astn'{end:302,start:300,value:i3}},'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3_b',name:'Astn'{end:310,start:306,value:i3_b}}],op_astns:['Astn'{end:305,start:303,value: (==)}]},'OmittedNode'{}]},'ImportFromStmt'{from_dots:['ImportDotNode'{dot:'Astn'{end:318,start:317,value: ('.')}}],from_name:'DottedNameNode'{items:['NameBareNode'{name:'Astn'{end:324,start:318,value:i1_sub}}]},import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4',name:'Astn'{end:340,start:338,value:i4}},name:'NameBareNode'{name:'Astn'{end:334,start:332,value:i4}}}]}},'ImportFromStmt'{from_dots:[],from_name:'DottedNameNode'{items:['NameBareNode'{name:'Astn'{end:354,start:347,value:pykythe}},'NameBareNode'{name:'Astn'{end:364,start:355,value:test_data}},'NameBareNode'{name:'Astn'{end:377,start:365,value:imports_dir1}},'NameBareNode'{name:'Astn'{end:384,start:378,value:i1_sub}}]},import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_b',name:'Astn'{end:402,start:398,value:i4_b}},name:'NameBareNode'{name:'Astn'{end:394,start:392,value:i4}}}]}},'ImportFromStmt'{from_dots:[],from_name:'DottedNameNode'{items:['NameBareNode'{name:'Astn'{end:416,start:409,value:pykythe}},'NameBareNode'{name:'Astn'{end:426,start:417,value:test_data}},'NameBareNode'{name:'Astn'{end:439,start:427,value:imports_dir1}},'NameBareNode'{name:'Astn'{end:446,start:440,value:i1_sub}},'NameBareNode'{name:'Astn'{end:449,start:447,value:i4}}]},import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_loc',name:'Astn'{end:470,start:464,value:i4_loc}},name:'NameBareNode'{name:'Astn'{end:460,start:457,value:loc}}}]}},'ImportFromStmt'{from_dots:[],from_name:'DottedNameNode'{items:['NameBareNode'{name:'Astn'{end:781,start:774,value:pykythe}},'NameBareNode'{name:'Astn'{end:791,start:782,value:test_data}},'NameBareNode'{name:'Astn'{end:804,start:792,value:imports_dir1}},'NameBareNode'{name:'Astn'{end:811,start:805,value:i1_sub}},'NameBareNode'{name:'Astn'{end:814,start:812,value:i4}}]},import_part:'ImportAsNamesNode'{items:['AsNameNode'{as_name:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.III',name:'Astn'{end:825,start:822,value:'III'}},name:'NameBareNode'{name:'Astn'{end:825,start:822,value:'III'}}}]}},'AssertStmt'{items:['OpNode'{args:['NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4',name:'Astn'{end:836,start:834,value:i4}},'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_b',name:'Astn'{end:844,start:840,value:i4_b}}],op_astns:['Astn'{end:839,start:837,value: (==)}]},'OmittedNode'{}]},'AssertStmt'{items:['OpNode'{args:['AtomDotNode'{atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3',name:'Astn'{end:975,start:973,value:i3}},attr_name:'Astn'{end:979,start:976,value:loc},binds:bool('False')},'StringNode'{astns:['Astn'{end:1020,start:983,value:'"pykythe/test_data/imports_dir/i3.py"'}]}],op_astns:['Astn'{end:982,start:980,value: (==)}]},'OmittedNode'{}]},'AssertStmt'{items:['OpNode'{args:['AtomDotNode'{atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i3_b',name:'Astn'{end:1032,start:1028,value:i3_b}},attr_name:'Astn'{end:1036,start:1033,value:loc},binds:bool('False')},'StringNode'{astns:['Astn'{end:1077,start:1040,value:'"pykythe/test_data/imports_dir/i3.py"'}]}],op_astns:['Astn'{end:1039,start:1037,value: (==)}]},'OmittedNode'{}]},'AssertStmt'{items:['OpNode'{args:['AtomDotNode'{atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4',name:'Astn'{end:1088,start:1086,value:i4}},attr_name:'Astn'{end:1092,start:1089,value:loc},binds:bool('False')},'StringNode'{astns:['Astn'{end:1140,start:1096,value:'"pykythe/test_data/imports_dir/i1_sub/i4.py"'}]}],op_astns:['Astn'{end:1095,start:1093,value: (==)}]},'OmittedNode'{}]},'AssertStmt'{items:['OpNode'{args:['AtomDotNode'{atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_b',name:'Astn'{end:1152,start:1148,value:i4_b}},attr_name:'Astn'{end:1156,start:1153,value:loc},binds:bool('False')},'StringNode'{astns:['Astn'{end:1204,start:1160,value:'"pykythe/test_data/imports_dir/i1_sub/i4.py"'}]}],op_astns:['Astn'{end:1159,start:1157,value: (==)}]},'OmittedNode'{}]},'AssertStmt'{items:['OpNode'{args:['NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_loc',name:'Astn'{end:1218,start:1212,value:i4_loc}},'StringNode'{astns:['Astn'{end:1266,start:1222,value:'"pykythe/test_data/imports_dir/i1_sub/i4.py"'}]}],op_astns:['Astn'{end:1221,start:1219,value: (==)}]},'OmittedNode'{}]},'AssignExprStmt'{expr:'AtomCallNode'{args:[],atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.III',name:'Astn'{end:1603,start:1600,value:'III'}}},left:'NameBindsFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.iii',name:'Astn'{end:1597,start:1594,value:iii}}},'AssertStmt'{items:['OpNode'{args:['AtomDotNode'{atom:'AtomCallNode'{args:[],atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.III',name:'Astn'{end:1764,start:1761,value:'III'}}},attr_name:'Astn'{end:1768,start:1767,value:x},binds:bool('False')},'StringNode'{astns:['Astn'{end:1816,start:1772,value:'"pykythe/test_data/imports_dir/i1_sub/i4.py"'}]}],op_astns:['Astn'{end:1771,start:1769,value: (==)}]},'OmittedNode'{}]},'ExprStmt'{expr:'AtomDotNode'{atom:'AtomDotNode'{atom:'NameRefFqn'{fqn:'.tmp.pykythe_test.SUBST.home.peter.src.pykythe.test_data.imports_dir1.i1.i4_b',name:'Astn'{end:3235,start:3231,value:i4_b}},attr_name:'Astn'{end:3239,start:3236,value:'III'},binds:bool('False')},attr_name:'Astn'{end:3241,start:3240,value:y},binds:bool('False')}}]},
    with_output_to(
            string(TermStr0),
            (current_output(TermStream),
             print_term(Term, [output(TermStream),tab_width(0),indent_arguments(2),right_margin(120)]))),
    re_replace(" *\n"/g, "\n", TermStr0, TermStr).
