code: def _find_address_and_connect(self, addresses):
          
          error_message = None
          for address in addresses:
              sock = self._create_socket(socket_family=address[0])
              try:
                  sock.connect(address[4])
              except (IOError, OSError) as why:
                  error_message = why.strerror
                  continue
              return sock
          raise AMQPConnectionError(
              'Could not connect to %s:%d error: %s' % (
                  self._parameters['hostname'], self._parameters['port'],
                  error_message
              )
          )
docs: Find and connect to the appropriate address.
  
          :param addresses:
  
          :raises AMQPConnectionError: Raises if the connection
                                       encountered an error.
  
          :rtype: socket.socket