'Find the domain object for a given domain name.
:param str domain_name: The domain name for which to find the corresponding Domain.
:returns: The Domain, if found.
:rtype: `~digitalocean.Domain`
:raises certbot.errors.PluginError: if no matching Domain is found.'

def _find_domain(self, domain_name):

    domain_name_guesses = dns_common.base_domain_name_guesses(domain_name)
    domains = self.manager.get_all_domains()
    for guess in domain_name_guesses:
        matches = [domain for domain in domains if (domain.name == guess)]
        if (len(matches) > 0):
            domain = matches[0]
            logger.debug('Found    base    domain    for    %s    using    name    %s', domain_name, guess)
            return domain
    raise errors.PluginError('Unable    to    determine    base    domain    for    {0}    using    names:    {1}.'.format(domain_name, domain_name_guesses))
