code: def datafind_connection(server=None):
      
  
      if server:
          datafind_server = server
      else:
          # Get the server name from the environment
          if 'LIGO_DATAFIND_SERVER' in os.environ:
              datafind_server = os.environ["LIGO_DATAFIND_SERVER"]
          else:
              err = "Trying to obtain the ligo datafind server url from "
              err += "the environment, ${LIGO_DATAFIND_SERVER}, but that "
              err += "variable is not populated."
              raise ValueError(err)
  
      # verify authentication options
      if not datafind_server.endswith("80"):
          cert_file, key_file = glue.datafind.find_credential()
      else:
          cert_file, key_file = None, None
  
      # Is a port specified in the server URL
      dfs_fields = datafind_server.split(':', 1)
      server = dfs_fields[0]
      port = int(dfs_fields[1]) if len(dfs_fields) == 2 else None
  
      # Open connection to the datafind server
      if cert_file and key_file:
          connection = glue.datafind.GWDataFindHTTPSConnection(
                  host=server, port=port, cert_file=cert_file, key_file=key_file)
      else:
          connection = glue.datafind.GWDataFindHTTPConnection(
                  host=server, port=port)
      return connection
docs: Return a connection to the datafind server
  
      Parameters
      -----------
      server : {SERVER:PORT, string}, optional
         A string representation of the server and port.
         The port may be ommitted.
  
      Returns
      --------
      connection
          The open connection to the datafind server.