code: def to_dict(self):
          
          d = {}
          if self.valid_since is not None:
              d['@valid_since'] = datetime_to_str(self.valid_since)
          for attr_list, prefix in [(self.attributes, '@'), (self.children, '')]:
              for attr in attr_list:
                  value = getattr(self, attr)
                  if isinstance(value, Serializable):
                      value = value.to_dict()
                  if value or isinstance(value, (bool, int, long)):
                      d[prefix + attr] = value
          if hasattr(self, 'display') and self.display:
              d['display'] = self.display
          return d
docs: Return a dict representation of the field.