__version__ = '1.6'
__version_branch_name = 'HEAD'
__version_cmake = '1.6.0.0'
__version_is_clean = 'True'
__version_last_release = '1.6'
__version_long = '1.6+77475b5'
__version_prerelease = 'None'
__version_release = 'True'

def version_formatter(formatstring='{version}'):
    if formatstring == 'all':
        formatstring = '{version} {{{branch}}} {githash} {cmake} {clean} {release} {lastrel} <-- {versionlong}'

    release = 'release' if (__version_release == 'True') else ('prerelease' if (__version_prerelease == 'True') else '')

    ans = formatstring.format(version=__version__,
                              versionlong=__version_long,
                              githash=__version_long[len(__version__)+1:],
                              clean='' if __version_is_clean == 'True' else 'dirty',
                              branch=__version_branch_name,
                              lastrel=__version_last_release,
                              cmake=__version_cmake,
                              release=release)
    return ans

if __name__ == '__main__':
    print(version_formatter(formatstring='all'))
