code: def current_version_option_validator(ctx, param, value):
      
  
      current_version = None
  
      if value:
          try:
              current_version = Version(value)
          except ValueError:
              ctx.fail(f"{value} is not a valid version string")
  
      # Look for the last git tag for the curren version
      git = Git()
      tag_pattern = ctx.params["tag_pattern"]
      versions = tag_analyzer(git.tags, tag_pattern, Version)
  
      # User provided current version. Try to find a tag that match it.
      if current_version:
          for version in versions:
              if version == current_version:
                  current_version = version
                  break
      elif versions:
          current_version = versions[0]
  
      ctx.params["current_tag"] = current_version.tag if current_version else None
      ctx.params["versions"] = versions
  
      return current_version
docs: If a version string is provided, validates it. Otherwise it tries
      to determine the current version from the last Git tag that matches
      ``tag_pattern`` option.
  
      Return a :class:`~braulio.version.Version` object or **None**.