code: def main(ctx, host, port, transport_type, timeout, ca_certs):
      
      if transport_type == 'udp':
          if timeout is not None:
              ctx.fail('--timeout cannot be used with the UDP transport')
          transport = riemann_client.transport.UDPTransport(host, port)
      elif transport_type == 'tcp':
          transport = riemann_client.transport.TCPTransport(host, port, timeout)
      elif transport_type == 'tls':
          if ca_certs is None:
              ctx.fail('--ca-certs must be set when using the TLS transport')
          transport = riemann_client.transport.TLSTransport(
              host, port, timeout, ca_certs)
      elif transport_type == 'none':
          transport = riemann_client.transport.BlankTransport()
  
      ctx.obj = transport
docs: Connects to a Riemann server to send events or query the index
  
      By default, will attempt to contact Riemann on localhost:5555 over TCP. The
      RIEMANN_HOST and RIEMANN_PORT environment variables can be used to
      configure the host and port used. Command line parameters will override the
      environment variables.
  
      Use `-T none` to test commands without actually connecting to a server.