code: async def create_turn_endpoint(protocol_factory, server_addr, username, password,
                                 lifetime=600, ssl=False, transport='udp'):
      
      loop = asyncio.get_event_loop()
      if transport == 'tcp':
          _, inner_protocol = await loop.create_connection(
              lambda: TurnClientTcpProtocol(server_addr,
                                            username=username,
                                            password=password,
                                            lifetime=lifetime),
              host=server_addr[0],
              port=server_addr[1],
              ssl=ssl)
      else:
          _, inner_protocol = await loop.create_datagram_endpoint(
              lambda: TurnClientUdpProtocol(server_addr,
                                            username=username,
                                            password=password,
                                            lifetime=lifetime),
              remote_addr=server_addr)
  
      protocol = protocol_factory()
      transport = TurnTransport(protocol, inner_protocol)
      await transport._connect()
  
      return transport, protocol
docs: Create datagram connection relayed over TURN.