<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reconnect(connection):
 """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 """

    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)