class_docstr: Pika-based event broker for publishing messages to RabbitMQ.
docstr: Configures the URL to connect to RabbitMQ.
docstr_tok: ["Configures","the","URL","to","connect","to","RabbitMQ","."]
code: def _configure_url(self) -> Optional[Text]:
      """Configures the URL to connect to RabbitMQ."""
      url = None
  
      if self.host.startswith("amqp"):
          parsed_host = urlparse(self.host)
  
          amqp_user = f"{self.username}:{self.password}"
          if amqp_user not in parsed_host.netloc:
              url = f"{parsed_host.scheme}://{amqp_user}@{parsed_host.netloc}"
          else:
              url = f"{parsed_host.scheme}://{parsed_host.netloc}"
  
          if str(self.port) not in url:
              url = f"{url}:{self.port}"
  
          if parsed_host.path:
              url = f"{url}{parsed_host.path}"
  
          if parsed_host.query:
              url = f"{url}?{parsed_host.query}"
  
      return url
  
imports: import asyncio
  import json
  import logging
  import structlog
  import os
  import ssl
  from asyncio import AbstractEventLoop
  from collections import deque
  from typing import Deque, Dict, Optional, Text, Union, Any, List, Set, Tuple, cast
  from urllib.parse import urlparse
  import aio_pika
  from rasa.shared.exceptions import RasaException
  from rasa.shared.constants import DOCS_URL_PIKA_EVENT_BROKER
  from rasa.core.brokers.broker import EventBroker
  import rasa.shared.utils.io
  from rasa.utils.endpoints import EndpointConfig
  from rasa.shared.utils.io import DEFAULT_ENCODING
  import rasa.shared.utils.common
label_desc: Use image node_id 3 for calling the PikaEventBroker obj's underlying member method code with example usage: obj._configure_url() and returns: url