code: def from_uri(cls, reactor, uri):
          
          uri = URI.fromBytes(uri.encode(), defaultPort=5672)
          kwargs = {}
          host = uri.host.decode()
          if "@" in host:
              auth, host = uri.netloc.decode().split("@")
              username, password = auth.split(":")
              kwargs.update({"username": username, "password": password})
  
          vhost = uri.path.decode()
          if len(vhost) > 1:
              vhost = vhost[1:]  # Strip leading "/"
          kwargs["vhost"] = vhost
  
          params = parse_qs(uri.query)
          kwargs.update({name.decode(): value[0].decode() for name, value in params.items()})
  
          if "heartbeat" in kwargs:
              kwargs["heartbeat"] = int(kwargs["heartbeat"])
          return cls(reactor, host, uri.port, **kwargs)
docs: Return an AMQEndpoint instance configured with the given AMQP uri.
  
          @see: https://www.rabbitmq.com/uri-spec.html