def renew(cls, fqdn, duration, background):
        """Renew a domain."""
        fqdn = fqdn.lower()
        if not background and not cls.intty():
            background = True

        domain_info = cls.info(fqdn)

        current_year = domain_info['date_registry_end'].year
        domain_params = {
            'duration': duration,
            'current_year': current_year,
        }

        result = cls.call('domain.renew', fqdn, domain_params)
        if background:
            return result

        # interactive mode, run a progress bar
        cls.echo('Renewing your domain.')
        cls.display_progress(result)
        cls.echo('Your domain %s has been renewed.' % fqdn)