Releases a new version

def release(no_master, release_type):
    '''Releases a new version'''

    try:
        locale.setlocale(locale.LC_ALL, '')
    except:
        print("Warning: Unable to set locale.  Expect encoding problems.")

    git.is_repo_clean(master=(not no_master))

    config = utils.get_config()
    config.update(utils.get_dist_metadata())
    config['project_dir'] = Path(os.getcwd())
    config['release_type'] = release_type

    with tempfile.TemporaryDirectory(prefix='ap_tmp') as tmp_dir:
        config['tmp_dir'] = tmp_dir
        values = release_ui(config)

        if type(values) is not str:
            utils.release(project_name=config['project_name'], tmp_dir=tmp_dir,
                          project_dir=config['project_dir'],
                          pypi_servers=config['pypi_servers'], **values)

            print('New release options:')
            pprint.pprint(values)
        else:
            print(values)