code: def bump(self, bump_part):
          
  
          major, minor, patch, stage, n = tuple(self)
  
          # stage bump
          if bump_part not in {"major", "minor", "patch"}:
  
              if bump_part not in self.stages:
                  raise ValueError(f"Unknown {bump_part} stage")
  
              # We can not bump from final stage to final again.
              if self.stage == "final" and bump_part == "final":
                  raise ValueError(f"{self} is already in final stage.")
  
              # bump in the same stage (numeric part)
              if bump_part == self.stage:
                  n += 1
              else:
                  new_stage_number = tuple(self.stages).index(bump_part)
  
                  # We can not bump to a previous stage
                  if new_stage_number < self._stage_number:
                      raise ValueError(f"{bump_part} stage is previous to {self}")
  
                  stage = bump_part
                  n = 0
          else:
              # major, minor, or patch bump
  
              # Only version in final stage can do a major, minor or patch
              # bump
              if self.stage != "final":
                  raise ValueError(
                      f"{self} is a pre-release version."
                      f" Can't do a {bump_part} version bump"
                  )
  
              if bump_part == "major":
                  major += 1
                  minor, patch = 0, 0
              elif bump_part == "minor":
                  minor += 1
                  patch = 0
              else:
                  patch += 1
  
          return Version(major=major, minor=minor, patch=patch, stage=stage, n=n)
docs: Return a new bumped version instance.