class_docstr: A class for administering the Kafka cluster.
  
  Warning:
      This is an unstable interface that was recently added and is subject to
      change without warning. In particular, many methods currently return
      raw protocol tuples. In future releases, we plan to make these into
      nicer, more pythonic objects. Unfortunately, this will likely break
      those interfaces.
  
  The KafkaAdminClient class will negotiate for the latest version of each message
  protocol format supported by both the kafka-python client library and the
  Kafka broker. Usage of optional fields from protocol versions that are not
  supported by the broker will result in IncompatibleBrokerVersion exceptions.
  
  Use of this class requires a minimum broker version >= 0.10.0.0.
  
  Keyword Arguments:
      bootstrap_servers: 'host[:port]' string (or list of 'host[:port]'
          strings) that the consumer should contact to bootstrap initial
          cluster metadata. This does not have to be the full node list.
          It just needs to have at least one broker that will respond to a
          Metadata API Request. Default port is 9092. If no servers are
          specified, will default to localhost:9092.
      client_id (str): a name for this client. This string is passed in
          each request to servers and can be used to identify specific
          server-side log entries that correspond to this client. Also
          submitted to GroupCoordinator for logging with respect to
          consumer group administration. Default: 'kafka-python-{version}'
      reconnect_backoff_ms (int): The amount of time in milliseconds to
          wait before attempting to reconnect to a given host.
          Default: 50.
      reconnect_backoff_max_ms (int): The maximum amount of time in
          milliseconds to backoff/wait when reconnecting to a broker that has
          repeatedly failed to connect. If provided, the backoff per host
          will increase exponentially for each consecutive connection
          failure, up to this maximum. Once the maximum is reached,
          reconnection attempts will continue periodically with this fixed
          rate. To avoid connection storms, a randomization factor of 0.2
          will be applied to the backoff resulting in a random range between
          20% below and 20% above the computed value. Default: 1000.
      request_timeout_ms (int): Client request timeout in milliseconds.
          Default: 30000.
      connections_max_idle_ms: Close idle connections after the number of
          milliseconds specified by this config. The broker closes idle
          connections after connections.max.idle.ms, so this avoids hitting
          unexpected socket disconnected errors on the client.
          Default: 540000
      retry_backoff_ms (int): Milliseconds to backoff when retrying on
          errors. Default: 100.
      max_in_flight_requests_per_connection (int): Requests are pipelined
          to kafka brokers up to this number of maximum requests per
          broker connection. Default: 5.
      receive_buffer_bytes (int): The size of the TCP receive buffer
          (SO_RCVBUF) to use when reading data. Default: None (relies on
          system defaults). Java client defaults to 32768.
      send_buffer_bytes (int): The size of the TCP send buffer
          (SO_SNDBUF) to use when sending data. Default: None (relies on
          system defaults). Java client defaults to 131072.
      socket_options (list): List of tuple-arguments to socket.setsockopt
          to apply to broker connection sockets. Default:
          [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]
      metadata_max_age_ms (int): The period of time in milliseconds after
          which we force a refresh of metadata even if we haven't seen any
          partition leadership changes to proactively discover any new
          brokers or partitions. Default: 300000
      security_protocol (str): Protocol used to communicate with brokers.
          Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.
          Default: PLAINTEXT.
      ssl_context (ssl.SSLContext): Pre-configured SSLContext for wrapping
          socket connections. If provided, all other ssl_* configurations
          will be ignored. Default: None.
      ssl_check_hostname (bool): Flag to configure whether SSL handshake
          should verify that the certificate matches the broker's hostname.
          Default: True.
      ssl_cafile (str): Optional filename of CA file to use in certificate
          verification. Default: None.
      ssl_certfile (str): Optional filename of file in PEM format containing
          the client certificate, as well as any CA certificates needed to
          establish the certificate's authenticity. Default: None.
      ssl_keyfile (str): Optional filename containing the client private key.
          Default: None.
      ssl_password (str): Optional password to be used when loading the
          certificate chain. Default: None.
      ssl_crlfile (str): Optional filename containing the CRL to check for
          certificate expiration. By default, no CRL check is done. When
          providing a file, only the leaf certificate will be checked against
          this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+.
          Default: None.
      api_version (tuple): Specify which Kafka API version to use. If set
          to None, KafkaClient will attempt to infer the broker version by
          probing various APIs. Example: (0, 10, 2). Default: None
      api_version_auto_timeout_ms (int): number of milliseconds to throw a
          timeout exception from the constructor when checking the broker
          api version. Only applies if api_version is None
      selector (selectors.BaseSelector): Provide a specific selector
          implementation to use for I/O multiplexing.
          Default: selectors.DefaultSelector
      metrics (kafka.metrics.Metrics): Optionally provide a metrics
          instance for capturing network IO stats. Default: None.
      metric_group_prefix (str): Prefix for metric names. Default: ''
      sasl_mechanism (str): Authentication mechanism when security_protocol
          is configured for SASL_PLAINTEXT or SASL_SSL. Valid values are:
          PLAIN, GSSAPI, OAUTHBEARER, SCRAM-SHA-256, SCRAM-SHA-512.
      sasl_plain_username (str): username for sasl PLAIN and SCRAM authentication.
          Required if sasl_mechanism is PLAIN or one of the SCRAM mechanisms.
      sasl_plain_password (str): password for sasl PLAIN and SCRAM authentication.
          Required if sasl_mechanism is PLAIN or one of the SCRAM mechanisms.
      sasl_kerberos_service_name (str): Service name to include in GSSAPI
          sasl mechanism handshake. Default: 'kafka'
      sasl_kerberos_domain_name (str): kerberos domain name to use in GSSAPI
          sasl mechanism handshake. Default: one of bootstrap servers
      sasl_oauth_token_provider (AbstractTokenProvider): OAuthBearer token provider
          instance. (See kafka.oauth.abstract). Default: None
      kafka_client (callable): Custom class / callable for creating KafkaClient instances
class_docstr_tok: ["A","class","for","administering","the","Kafka","cluster",".","Warning",":","This","is","an","unstable","interface","that","was","recently","added","and","is","subject","to","change","without","warning",".","In","particular",",","many","methods","currently","return","raw","protocol","tuples",".","In","future","releases",",","we","plan","to","make","these","into","nicer",",","more","pythonic","objects",".","Unfortunately",",","this","will","likely","break","those","interfaces",".","The","KafkaAdminClient","class","will","negotiate","for","the","latest","version","of","each","message","protocol","format","supported","by","both","the","kafka-python","client","library","and","the","Kafka","broker",".","Usage","of","optional","fields","from","protocol","versions","that","are","not","supported","by","the","broker","will","result","in","IncompatibleBrokerVersion","exceptions",".","Use","of","this","class","requires","a","minimum","broker","version",">","=","0.10.0.0",".","Keyword","Arguments",":","bootstrap_servers",":","'host","[",":","port","]","'","string","(","or","list","of","'host","[",":","port","]","'","strings",")","that","the","consumer","should","contact","to","bootstrap","initial","cluster","metadata",".","This","does","not","have","to","be","the","full","node","list",".","It","just","needs","to","have","at","least","one","broker","that","will","respond","to","a","Metadata","API","Request",".","Default","port","is","9092",".","If","no","servers","are","specified",",","will","default","to","localhost:9092.","client_id","(","str",")",":","a","name","for","this","client",".","This","string","is","passed","in","each","request","to","servers","and","can","be","used","to","identify","specific","server-side","log","entries","that","correspond","to","this","client",".","Also","submitted","to","GroupCoordinator","for","logging","with","respect","to","consumer","group","administration",".","Default",":","'kafka-python-","{","version","}","'","reconnect_backoff_ms","(","int",")",":","The","amount","of","time","in","milliseconds","to","wait","before","attempting","to","reconnect","to","a","given","host",".","Default",":","50.","reconnect_backoff_max_ms","(","int",")",":","The","maximum","amount","of","time","in","milliseconds","to","backoff\/wait","when","reconnecting","to","a","broker","that","has","repeatedly","failed","to","connect",".","If","provided",",","the","backoff","per","host","will","increase","exponentially","for","each","consecutive","connection","failure",",","up","to","this","maximum",".","Once","the","maximum","is","reached",",","reconnection","attempts","will","continue","periodically","with","this","fixed","rate",".","To","avoid","connection","storms",",","a","randomization","factor","of","0.2","will","be","applied","to","the","backoff","resulting","in","a","random","range","between","20","%","below","and","20","%","above","the","computed","value",".","Default",":","1000.","request_timeout_ms","(","int",")",":","Client","request","timeout","in","milliseconds",".","Default",":","30000.","connections_max_idle_ms",":","Close","idle","connections","after","the","number","of","milliseconds","specified","by","this","config",".","The","broker","closes","idle","connections","after","connections.max.idle.ms",",","so","this","avoids","hitting","unexpected","socket","disconnected","errors","on","the","client",".","Default",":","540000","retry_backoff_ms","(","int",")",":","Milliseconds","to","backoff","when","retrying","on","errors",".","Default",":","100.","max_in_flight_requests_per_connection","(","int",")",":","Requests","are","pipelined","to","kafka","brokers","up","to","this","number","of","maximum","requests","per","broker","connection",".","Default",":","5.","receive_buffer_bytes","(","int",")",":","The","size","of","the","TCP","receive","buffer","(","SO_RCVBUF",")","to","use","when","reading","data",".","Default",":","None","(","relies","on","system","defaults",")",".","Java","client","defaults","to","32768.","send_buffer_bytes","(","int",")",":","The","size","of","the","TCP","send","buffer","(","SO_SNDBUF",")","to","use","when","sending","data",".","Default",":","None","(","relies","on","system","defaults",")",".","Java","client","defaults","to","131072.","socket_options","(","list",")",":","List","of","tuple-arguments","to","socket.setsockopt","to","apply","to","broker","connection","sockets",".","Default",":","[","(","socket.IPPROTO_TCP",",","socket.TCP_NODELAY",",","1",")","]","metadata_max_age_ms","(","int",")",":","The","period","of","time","in","milliseconds","after","which","we","force","a","refresh","of","metadata","even","if","we","have","n't","seen","any","partition","leadership","changes","to","proactively","discover","any","new","brokers","or","partitions",".","Default",":","300000","security_protocol","(","str",")",":","Protocol","used","to","communicate","with","brokers",".","Valid","values","are",":","PLAINTEXT",",","SSL",",","SASL_PLAINTEXT",",","SASL_SSL",".","Default",":","PLAINTEXT",".","ssl_context","(","ssl.SSLContext",")",":","Pre-configured","SSLContext","for","wrapping","socket","connections",".","If","provided",",","all","other","ssl_","*","configurations","will","be","ignored",".","Default",":","None",".","ssl_check_hostname","(","bool",")",":","Flag","to","configure","whether","SSL","handshake","should","verify","that","the","certificate","matches","the","broker","'s","hostname",".","Default",":","True",".","ssl_cafile","(","str",")",":","Optional","filename","of","CA","file","to","use","in","certificate","verification",".","Default",":","None",".","ssl_certfile","(","str",")",":","Optional","filename","of","file","in","PEM","format","containing","the","client","certificate",",","as","well","as","any","CA","certificates","needed","to","establish","the","certificate","'s","authenticity",".","Default",":","None",".","ssl_keyfile","(","str",")",":","Optional","filename","containing","the","client","private","key",".","Default",":","None",".","ssl_password","(","str",")",":","Optional","password","to","be","used","when","loading","the","certificate","chain",".","Default",":","None",".","ssl_crlfile","(","str",")",":","Optional","filename","containing","the","CRL","to","check","for","certificate","expiration",".","By","default",",","no","CRL","check","is","done",".","When","providing","a","file",",","only","the","leaf","certificate","will","be","checked","against","this","CRL",".","The","CRL","can","only","be","checked","with","Python","3.4+","or","2.7.9+",".","Default",":","None",".","api_version","(","tuple",")",":","Specify","which","Kafka","API","version","to","use",".","If","set","to","None",",","KafkaClient","will","attempt","to","infer","the","broker","version","by","probing","various","APIs",".","Example",":","(","0",",","10",",","2",")",".","Default",":","None","api_version_auto_timeout_ms","(","int",")",":","number","of","milliseconds","to","throw","a","timeout","exception","from","the","constructor","when","checking","the","broker","api","version",".","Only","applies","if","api_version","is","None","selector","(","selectors.BaseSelector",")",":","Provide","a","specific","selector","implementation","to","use","for","I\/O","multiplexing",".","Default",":","selectors.DefaultSelector","metrics","(","kafka.metrics.Metrics",")",":","Optionally","provide","a","metrics","instance","for","capturing","network","IO","stats",".","Default",":","None",".","metric_group_prefix","(","str",")",":","Prefix","for","metric","names",".","Default",":","``","sasl_mechanism","(","str",")",":","Authentication","mechanism","when","security_protocol","is","configured","for","SASL_PLAINTEXT","or","SASL_SSL",".","Valid","values","are",":","PLAIN",",","GSSAPI",",","OAUTHBEARER",",","SCRAM-SHA-256",",","SCRAM-SHA-512",".","sasl_plain_username","(","str",")",":","username","for","sasl","PLAIN","and","SCRAM","authentication",".","Required","if","sasl_mechanism","is","PLAIN","or","one","of","the","SCRAM","mechanisms",".","sasl_plain_password","(","str",")",":","password","for","sasl","PLAIN","and","SCRAM","authentication",".","Required","if","sasl_mechanism","is","PLAIN","or","one","of","the","SCRAM","mechanisms",".","sasl_kerberos_service_name","(","str",")",":","Service","name","to","include","in","GSSAPI","sasl","mechanism","handshake",".","Default",":","'kafka'","sasl_kerberos_domain_name","(","str",")",":","kerberos","domain","name","to","use","in","GSSAPI","sasl","mechanism","handshake",".","Default",":","one","of","bootstrap","servers","sasl_oauth_token_provider","(","AbstractTokenProvider",")",":","OAuthBearer","token","provider","instance",".","(","See","kafka.oauth.abstract",")",".","Default",":","None","kafka_client","(","callable",")",":","Custom","class","\/","callable","for","creating","KafkaClient","instances"]
code: def _convert_describe_acls_response_to_acls(describe_response):
      version = describe_response.API_VERSION
  
      error = Errors.for_code(describe_response.error_code)
      acl_list = []
      for resources in describe_response.resources:
          if version == 0:
              resource_type, resource_name, acls = resources
              resource_pattern_type = (
                  ACLResourcePatternType.LITERAL.value
              )
          elif version <= 1:
              (
                  resource_type,
                  resource_name,
                  resource_pattern_type,
                  acls,
              ) = resources
          else:
              raise NotImplementedError(
                  "Support for DescribeAcls Response v{} has not yet been added to KafkaAdmin.".format(
                      version
                  )
              )
          for acl in acls:
              principal, host, operation, permission_type = acl
              conv_acl = ACL(
                  principal=principal,
                  host=host,
                  operation=ACLOperation(operation),
                  permission_type=ACLPermissionType(permission_type),
                  resource_pattern=ResourcePattern(
                      ResourceType(resource_type),
                      resource_name,
                      ACLResourcePatternType(resource_pattern_type),
                  ),
              )
              acl_list.append(conv_acl)
  
      return (
          acl_list,
          error,
      )
  
imports: from __future__ import absolute_import
  from collections import defaultdict
  import copy
  import logging
  import socket
  from .None import ConfigResourceType
  from kafka.vendor import six
  from kafka.admin.acl_resource import ACLOperation, ACLPermissionType, ACLFilter, ACL, ResourcePattern, ResourceType, ACLResourcePatternType
  from kafka.client_async import KafkaClient, selectors
  from kafka.coordinator.protocol import ConsumerProtocolMemberMetadata, ConsumerProtocolMemberAssignment, ConsumerProtocol
  import kafka.errors
  from kafka.errors import IncompatibleBrokerVersion, KafkaConfigurationError, NotControllerError, UnrecognizedBrokerVersion, IllegalArgumentError
  from kafka.metrics import MetricConfig, Metrics
  from kafka.protocol.admin import CreateTopicsRequest, DeleteTopicsRequest, DescribeConfigsRequest, AlterConfigsRequest, CreatePartitionsRequest, ListGroupsRequest, DescribeGroupsRequest, DescribeAclsRequest, CreateAclsRequest, DeleteAclsRequest, DeleteGroupsRequest
  from kafka.protocol.commit import GroupCoordinatorRequest, OffsetFetchRequest
  from kafka.protocol.metadata import MetadataRequest
  from kafka.protocol.types import Array
  from kafka.structs import TopicPartition, OffsetAndMetadata, MemberInformation, GroupInformation
  from kafka.version import __version__
label_desc: Use image node_id 18 for calling the KafkaAdminClient obj's underlying member method code with example usage: obj._convert_describe_acls_response_to_acls(describe_response) and returns: acl_list,  error