code: def to_xml(self):
          '''
          Returns a DOM representation of the payment.
          @return: Element
          '''
          for n, v in { "amount": self.amount, "date": self.date,
                       "method":self.method}.items():
              if is_empty_or_none(v):
                  raise PaymentError("'%s' attribute cannot be empty or " \
                                         "None." % n)
  
          doc = Document()
          root = doc.createElement("payment")
          super(Payment, self).to_xml(root)
          self._create_text_node(root, "amount", self.amount)
          self._create_text_node(root, "method", self.method)
          self._create_text_node(root, "reference", self.ref, True)
          self._create_text_node(root, "date", self.date)
          return roof to_xml(self):
          '''
          Returns a DOM representation of the payment.
          @return: Element
          '''
          for n, v in { "amount": self.amount, "date": self.date,
                       "method":self.method}.items():
              if is_empty_or_none(v):
                  raise PaymentError("'%s' attribute cannot be empty or " \
                                         "None." % n)
  
          doc = Document()
          root = doc.createElement("payment")
          super(Payment, self).to_xml(root)
          self._create_text_node(root, "amount", self.amount)
          self._create_text_node(root, "method", self.method)
          self._create_text_node(root, "reference", self.ref, True)
          self._create_text_node(root, "date", self.date)
          return root
docs: Returns a DOM representation of the payment.
          @return: Element