'Tag an image into a repository.
:param name: name of the image. required.
:param tag: image tag.
:param repository: path to the repository. required.
:param force: bool. force tagging, even it image already exists with the repository path.
:param push: bool. push the image once it\'s tagged.
:return: None'

def tag_image(self, name, tag, repository, force=False, push=False):

    (repo, repo_tag) = parse_repository_tag(repository)
    if (not repo_tag):
        repo_tag = 'latest'
        if tag:
            repo_tag = tag
    image = self.client.find_image(name=repo, tag=repo_tag)
    found = ('found' if image else 'not    found')
    self.log(('image    %s    was    %s' % (repo, found)))
    if ((not image) or force):
        self.log(('tagging    %s:%s    to    %s:%s' % (name, tag, repo, repo_tag)))
        self.results['changed'] = True
        self.results['actions'].append(('Tagged    image    %s:%s    to    %s:%s' % (name, tag, repo, repo_tag)))
        if (not self.check_mode):
            try:
                image_name = name
                if (tag and (not re.search(tag, name))):
                    image_name = ('%s:%s' % (name, tag))
                tag_status = self.client.tag(image_name, repo, tag=repo_tag, force=True)
                if (not tag_status):
                    raise Exception('Tag    operation    failed.')
            except Exception as exc:
                self.fail(('Error:    failed    to    tag    image    -    %s' % str(exc)))
            self.results['image'] = self.client.find_image(name=repo, tag=repo_tag)
            if push:
                self.push_image(repo, repo_tag)
