<s> import nbt <EOL> def nested_string ( tag , indent_string = "<STR_LIT:U+0020>" , indent = <NUM_LIT:0> ) : <EOL> result = "<STR_LIT>" <EOL> if tag . tagID == nbt . TAG_COMPOUND : <EOL> result += '<STR_LIT>' <EOL> indent += <NUM_LIT:1> <EOL> for key , value in tag . iteritems ( ) : <EOL> result += indent_string * indent + '<STR_LIT>' % ( key , nested_string ( value , indent_string , indent ) ) <EOL> indent -= <NUM_LIT:1> <EOL> result += indent_string * indent + '<STR_LIT>' <EOL> elif tag . tagID == nbt . TAG_LIST : <EOL> result += '<STR_LIT>' <EOL> indent += <NUM_LIT:1> <EOL> for index , value in enumerate ( tag ) : <EOL> result += indent_string * indent + nested_string ( value , indent_string , indent ) + "<STR_LIT>" <EOL> indent -= <NUM_LIT:1> <EOL> result += indent_string * indent + '<STR_LIT>' <EOL> else : <EOL> result += "<STR_LIT>" % ( tag . __class__ . __name__ , tag . value ) <EOL> return result </s>
