code: def tagversion(repo, level='patch', special=''):
      
      prepend = 'v'
      with lcd(repo):
          oldversion = local(
              'git describe --abbrev=0 --tags', capture=True).strip()
          if oldversion.startswith('v'):
              oldversion = oldversion[1:]
          else:
              prepend = ''
      major, minor, patch = [int(x) for x in re.split('\D', oldversion, 3)[:3]]
      if special:
          if not re.match('^[a-z]', special):
              raise ValueError('Special must start with a-z')
          if not re.match('[_a-zA-Z0-9]+', special):
              raise ValueError('Must contain start with lowercase letter')
      if level == 'major':
          major, minor, patch = major + 1, 0, 0
      elif level == 'minor':
          major, minor, patch = major, minor + 1, 0
      elif level == 'patch':
          major, minor, patch = major, minor, patch + 1
      version_string = '{}.{}.{}'.format(major, minor, patch) + special
      with lcd(repo):
          local('git tag -s --force {}{}'.format(prepend, version_string))
      return version_string
docs: Increment and return tagged version in git.
      Increment levels are patch, minor and major.
  
      Using semver.org versioning: {major}.{minor}.{patch}{special}
      Special must start with a-z and consist of _a-zA-Z0-9.