Allocates the next version number and marks current develop branch
    state as a new release with the allocated version number.
    Syncs new state with origin repository.

def mkrelease(finish='yes', version=''):
    """Allocates the next version number and marks current develop branch
    state as a new release with the allocated version number.
    Syncs new state with origin repository.
    """
    if not version:
        version = _version_format(_version_guess_next())

    if _git_get_current_branch() != 'release/' + version:
        _tool_run('git checkout develop',
                  'git flow release start ' + version)

    _project_patch_version(version)
    _project_patch_changelog()
    patched_files = ' '.join([VERSION_FILE, CHANGES_FILE])

    run('git diff ' + patched_files, pty=True)
    _tool_run(('git commit -m "Bump Version to {0!s}" {1!s}'
               .format(version, patched_files)))

    if finish not in ('no', 'n', ):
        _tool_run("git flow release finish -m '{0}' {0}".format(version),
                  env={b'GIT_MERGE_AUTOEDIT': b'no', })
        _tool_run('git push origin --tags develop master')