docs: def is_provider_configured(opts, provider, required_keys=(), log_message=True, aliases=()):
      '''
      Check and return the first matching and fully configured cloud provider
      configuration.
      '''
      if ':' in provider:
          alias, driver = provider.split(':')
          if alias not in opts['providers']:
              return False
          if driver not in opts['providers'][alias]:
              return False
          for key in required_keys:
              if opts['providers'][alias][driver].get(key, None) is None:
                  if log_message is True:
                      # There's at least one require configuration key which is not
                      # set.
                      log.warning(
                          "The required '%s' configuration setting is missing "
                          "from the '%s' driver, which is configured under the "
                          "'%s' alias.", key, provider, alias
                      )
                  return False
          # If we reached this far, there's a properly configured provider.
          # Return it!
          return opts['providers'][alias][driver]
  
      for alias, drivers in six.iteritems(opts['providers']):
          for driver, provider_details in six.iteritems(drivers):
              if driver != provider and driver not in aliases:
                  continue
  
              # If we reached this far, we have a matching provider, let's see if
              # all required configuration keys are present and not None.
              skip_provider = False
              for key in required_keys:
                  if provider_details.get(key, None) is None:
                      if log_message is True:
                          # This provider does not include all necessary keys,
                          # continue to next one.
                          log.warning(
                              "The required '%s' configuration setting is "
                              "missing from the '%s' driver, which is configured "
                              "under the '%s' alias.", key, provider, alias
                          )
                      skip_provider = True
                      break
  
              if skip_provider:
                  continue
  
              # If we reached this far, the provider included all required keys
              return provider_details
  
      # If we reached this point, the provider is not configured.
      return False