def get_current_version(projdir=PROJDIR, pattern=PATTERN, logger=None):
 tags = get_recent_tags(projdir)
 try:
  tag = tags[0][0]
 except IndexError:
  return
 matches = re.match(pattern, tag)
 try:
  current_version = matches.group(1)
 except (IndexError, AttributeError) as err:
  if logger:
   logger.exception(err)
  return tag
 return current_version

def get_current_version ( projdir = PROJDIR , pattern = PATTERN , logger = None ) : tags = get_recent_tags ( projdir ) try : tag = tags [ 0 ] [ 0 ] except IndexError : return matches = re . match ( pattern , tag ) try : current_version = matches . group ( 1 ) except ( IndexError , AttributeError ) as err : if logger : logger . exception ( err ) return tag return current_version
return the most recent tag .