'Obtain and enroll certificate.
Get a new certificate for the specified domains using the specified
authenticator and installer, and then create a new renewable lineage
containing it.
:param list domains: Domains to request.
:param plugins: A PluginsFactory object.
:param str certname: Name of new cert
:returns: A new :class:`certbot.storage.RenewableCert` instance
referred to the enrolled cert lineage, False if the cert could not
be obtained, or None if doing a successful dry run.'

def obtain_and_enroll_certificate(self, domains, certname):

    (certr, chain, key, _) = self.obtain_certificate(domains)
    if ((self.config.config_dir != constants.CLI_DEFAULTS['config_dir']) or (self.config.work_dir != constants.CLI_DEFAULTS['work_dir'])):
        logger.warning('Non-standard    path(s),    might    not    work    with    crontab    installed    by    your    operating    system    package    manager')
    new_name = (certname if certname else domains[0])
    if self.config.dry_run:
        logger.debug('Dry    run:    Skipping    creating    new    lineage    for    %s', new_name)
        return None
    else:
        return storage.RenewableCert.new_lineage(new_name, OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, certr.body.wrapped), key.pem, crypto_util.dump_pyopenssl_chain(chain), self.config)
