def METHOD_NAME(version):
    # git describe produce version in the form: v0.9.8-20-gf0f45ca
    # where 20 is the number of commit since last release, and gf0f45ca is the short commit id
    # preceded by 'g' we parse this a transform into a pep440 release version 0.9.9.dev20
    # (increment last digit and add dev before 20)
    VERSION_MATCH = re.compile(r'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.post(?P<post>\d+))?(-(?P<dev>\d+))?(-g(?P<commit>.+))?')  # noqa pylint: disable=line-too-long
    v = VERSION_MATCH.search(version)
    if v:
        major = int(v.group('major'))
        minor = int(v.group('minor'))
        patch = int(v.group('patch'))
        if v.group('dev'):
            patch += 1
            dev = int(v.group('dev'))
            return f"{major}.{minor}.{patch}-dev{dev}"
        if v.group('post'):
            return f"{major}.{minor}.{patch}.post{v.group('post')}"
        return f"{major}.{minor}.{patch}"
    return v