code: def safestr(value):
      '''Ensure type to string serialization'''
      if not value or isinstance(value, (int, float, bool, long)):
          return value
      elif isinstance(value, (date, datetime)):
          return value.isoformat()
      else:
          return unicode(valuef safestr(value):
      '''Ensure type to string serialization'''
      if not value or isinstance(value, (int, float, bool, long)):
          return value
      elif isinstance(value, (date, datetime)):
          return value.isoformat()
      else:
          return unicode(value)
docs: Ensure type to string serialization