<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def atlas_log_socket_error( method_invocation, peer_hostport, se ):
 """ Log a socket exception tastefully """

    if isinstance( se, socket.timeout ):
        log.debug("%s %s: timed out (socket.timeout)" % (method_invocation, peer_hostport))

    elif isinstance( se, socket.gaierror ):
        log.debug("%s %s: failed to query address or info (socket.gaierror)" % (method_invocation, peer_hostport ))

    elif isinstance( se, socket.herror ):
        log.debug("%s %s: failed to query host info (socket.herror)" % (method_invocation, peer_hostport ))

    elif isinstance( se, socket.error ):
        if se.errno == errno.ECONNREFUSED:
            log.debug("%s %s: is unreachable (socket.error ECONNREFUSED)" % (method_invocation, peer_hostport))
        elif se.errno == errno.ETIMEDOUT:
            log.debug("%s %s: timed out (socket.error ETIMEDOUT)" % (method_invocation, peer_hostport))
        else:
            log.debug("%s %s: socket error" % (method_invocation, peer_hostport))
            log.exception(se)

    else:
        log.debug("%s %s: general exception" % (method_invocation, peer_hostport))
        log.exception(se)