code: def authenticate_keystone(self, keystone_ip, username, password,
                                api_version=False, admin_port=False,
                                user_domain_name=None, domain_name=None,
                                project_domain_name=None, project_name=None):
          
          self.log.debug('Authenticating with keystone...')
          if not api_version:
              api_version = 2
          sess, auth = self.get_keystone_session(
              keystone_ip=keystone_ip,
              username=username,
              password=password,
              api_version=api_version,
              admin_port=admin_port,
              user_domain_name=user_domain_name,
              domain_name=domain_name,
              project_domain_name=project_domain_name,
              project_name=project_name
          )
          if api_version == 2:
              client = keystone_client.Client(session=sess)
          else:
              client = keystone_client_v3.Client(session=sess)
          # This populates the client.service_catalog
          client.auth_ref = auth.get_access(sess)
          return client
docs: Authenticate with Keystone