<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def update_version(self, version, step=1):
        "Compute an new version and write it as a tag"

        # update the version based on the flags passed.
        if self.config.patch:
            version.patch += step
        if self.config.minor:
            version.minor += step
        if self.config.major:
            version.major += step
        if self.config.build:
            version.build_number += step
        if self.config.build_number:
            version.build_number = self.config.build_number

        # create a new tag in the repo with the new version.
        if self.config.dry_run:
            log.info('Not updating repo to version {0}, because of --dry-run'.format(version))
        else:
            version = self.call_plugin_function('set_version', version)

        return version