remove useless temporary variables in getstring()
change the use od id as a variable name to entity in getstring() because it's a reserver python name
Simplify getstring() code