def bump_version(args, version):
    """Increment the version number if requested.

    Parameters
    ----------
    args : object like argparse.Namespace
        The arguments determining if we are to bump the version number.
    version : dict
        The current version.

    Returns
    -------
    new_version : dict
        The updated version (if an update is requested). Otherwise it
        is just a copy of the input version.

    """
    new_version = version.copy()
    if args.bump_dev:
        new_version['dev'] += 1
    if args.bump_micro:
        new_version['micro'] += 1
        new_version['dev'] = 0
    if args.bump_minor:
        new_version['minor'] += 1
        new_version['micro'] = 0
        new_version['dev'] = 0
    if args.bump_major:
        new_version['major'] += 1
        new_version['minor'] = 0
        new_version['micro'] = 0
        new_version['dev'] = 0
    return new_version