code: def revision_number(self):
          
          revision = self.revision
          if revision is None:
              return 0
          revision_str = revision.text
          try:
              revision = int(revision_str)
          except ValueError:
              # non-integer revision strings also resolve to 0
              revision = 0
          # as do negative integers
          if revision < 0:
              revision = 0
          return revision
docs: Integer value of revision property.