code: def string(v):
      
      if nodesetp(v):
          if not v:
              return u''
          return string_value(v[0])
      elif numberp(v):
          if v == float('inf'):
              return u'Infinity'
          elif v == float('-inf'):
              return u'-Infinity'
          elif str(v) == 'nan':
              return u'NaN'
          elif int(v) == v and v <= 0xffffffff:
              v = int(v)
          return unicode(v)
      elif booleanp(v):
          return u'true' if v else u'false'
      return v
docs: Convert a value to a string.