def bump_version(version: Version, kind: str) -> Version:
    (major, minor, patch, post) = (version.major, version.minor, version.micro, version.post)
    if (kind == 'post'):
        if (post is None):
            post = ('post', 1)
        else:
            post = (post[0], (post[1] + 1))
    elif (kind == 'patch'):
        post = None
        patch += 1
    elif (kind == 'minor'):
        post = None
        patch = 0
        minor += 1
    elif (kind == 'major'):
        post = None
        patch = minor = 0
        major += 1
    else:
        raise ValueError('invalid kind: {!r}'.format(kind))
    string = ('%s.%s.%s' % (major, minor, patch))
    if post:
        string += ('.post' + str(post))
    return Version(string)
def bump_version(version: Version, kind: str) -> Version:
    (major, minor, patch, post) = (version.major, version.minor, version.micro, version.post)
    if (kind == 'post'):
        if (post is None):
            post = ('post', 1)
        else:
            post = (post[0], (post[1] + 1))
    elif (kind == 'patch'):
        post = None
        patch += 1
    elif (kind == 'minor'):
        post = None
        patch = 0
        minor += 1
    elif (kind == 'major'):
        post = None
        patch = minor = 0
        major += 1
    else:
        raise ValueError('invalid kind: {!r}'.format(kind))
    string = ('%s.%s.%s' % (major, minor, patch))
    if post:
        string += ('.post' + str(post))
    return Version(string)