def reconnect(connection):
if isinstance(connection, FflConnection):<EOL><INDENT>return type(connection)(connection.ffldir)<EOL><DEDENT>kw = {'<STR_LIT>': connection._context} if connection.port != <NUM_LIT> else {}<EOL>return connection.__class__(connection.host, port=connection.port, **kw)<EOL>
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