code: def _get_revision(self):
          
          assert self._revisions, "no migration revision exist"
          revision = self._rev or self._revisions[-1]
          # revision count must be less or equal since revisions are ordered
          assert revision in self._revisions, "invalid revision specified"
          return revision
docs: Validate and return the revision to use for current command