code: def from_conf(
      federation_session_id: str,
      computing_session,
      party: PartyMeta,
      parties: List[PartyMeta],
      route_table: dict,
      mode: str,
      host: str,
      port: int,
      mng_port: int,
      topic_ttl: Optional[int],
      cluster: Optional[str],
      tenant: Optional[str],
      max_message_size: Optional[int],
      base_user: Optional[str] = None,
      base_password: Optional[str] = None,
      pulsar_run: dict = {},
      connection: dict = {},
  ):
      if topic_ttl is None:
          topic_ttl = 0
      if cluster is None:
          cluster = DEFAULT_CLUSTER
      if tenant is None:
          tenant = DEFAULT_TENANT
      if "max_message_size" in pulsar_run:
          max_message_size = pulsar_run["max_message_size"]
      if "topic_ttl" in pulsar_run:
          topic_ttl = pulsar_run["topic_ttl"]
  
      # pulsar not use user and password so far
      # TODO add credential to connections
      pulsar_manager = PulsarManager(
          host=host, port=mng_port, runtime_config=pulsar_run
      )
  
      # init tenant
      tenant_info = pulsar_manager.get_tenant(tenant=tenant).json()
      if tenant_info.get("allowedClusters") is None:
          pulsar_manager.create_tenant(
              tenant=tenant, admins=[], clusters=[cluster]
          )
  
      mq = MQ(host, port, route_table)
  
      connection = pulsar_manager.runtime_config.get("connection", {})
  
      LOGGER.debug(f"federation mode={mode}")
  
      return PulsarFederation(
          federation_session_id,
          computing_session,
          party,
          parties,
          mq,
          pulsar_manager,
          max_message_size,
          topic_ttl,
          cluster,
          tenant,
          connection,
          mode,
      )
  
imports: import logging
  from typing import List, Optional
  from fate.arch.federation.api import PartyMeta
  from fate.arch.federation.message_queue import MessageQueueBasedFederation
  from ._mq_channel import DEFAULT_CLUSTER, DEFAULT_SUBSCRIPTION_NAME, DEFAULT_TENANT, MQChannel
  from ._pulsar_manager import PulsarManager
label_desc: Use image node_id 1 for calling the PulsarFederation obj's underlying member method code with example usage: obj.from_conf(federation_session_id, computing_session, party, parties, route_table, mode, host, port, mng_port, topic_ttl, cluster, tenant, max_message_size, base_user, base_password, pulsar_run, connection) and returns: PulsarFederation