code: def reconnect(connection):
      
      if isinstance(connection, FflConnection):
          return type(connection)(connection.ffldir)
      kw = {'context': connection._context} if connection.port != 80 else {}
      return connection.__class__(connection.host, port=connection.port, **kw)
docs: Open a new datafind connection based on an existing connection
  
      This is required because of https://git.ligo.org/lscsoft/glue/issues/1
  
      Parameters
      ----------
      connection : :class:`~gwdatafind.http.HTTPConnection` or `FflConnection`
          a connection object (doesn't need to be open)
  
      Returns
      -------
      newconn : :class:`~gwdatafind.http.HTTPConnection` or `FflConnection`
          the new open connection to the same `host:port` server