<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def finalizenames(self, client, finalimage):
 """ Tag the built image with its final name and untag intermediate containers """

        client.api.tag(finalimage, *self.targetname.split(':'))
        cprint('Tagged final image as "%s"' % self.targetname,
               'green')
        if not self.keepbuildtags:
            print('Untagging intermediate containers:', end='')
            for step in self.steps:
                client.api.remove_image(step.buildname, force=True)
                print(step.buildname, end=',')
            print()