'Find the zone_id for a given domain.
:param str domain: The domain for which to find the zone_id.
:returns: The zone_id, if found.
:rtype: str
:raises certbot.errors.PluginError: if no zone_id is found.'

def _find_zone_id(self, domain):

    zone_name_guesses = dns_common.base_domain_name_guesses(domain)
    for zone_name in zone_name_guesses:
        params = {'name': zone_name, 'per_page': 1}
        try:
            zones = self.cf.zones.get(params=params)
        except CloudFlare.exceptions.CloudFlareAPIError as e:
            code = int(e)
            hint = None
            if (code == 6003):
                hint = 'Did    you    copy    your    entire    API    key?'
            elif (code == 9103):
                hint = 'Did    you    enter    the    correct    email    address?'
            raise errors.PluginError('Error    determining    zone_id:    {0}    {1}.    Please    confirm    that    you    have    supplied    valid    Cloudflare    API    credentials.{2}'.format(code, e, ('    ({0})'.format(hint) if hint else '')))
        if (len(zones) > 0):
            zone_id = zones[0]['id']
            logger.debug('Found    zone_id    of    %s    for    %s    using    name    %s', zone_id, domain, zone_name)
            return zone_id
    raise errors.PluginError('Unable    to    determine    zone_id    for    {0}    using    zone    names:    {1}.    Please    confirm    that    the    domain    name    has    been    entered    correctly    and    is    already    associated    with    the    supplied    Cloudflare    account.'.format(domain, zone_name_guesses))
