def getSocketFamily(socket):
    """
    Return the family of the given socket.

    @param socket: The socket to get the family of.
    @type socket: L{socket.socket}

    @rtype: L{int}
    """
    if _PY3:
        return socket.family
    else:
        return getsockfam(socket.fileno())

    Return the family of the given socket.

    @param socket: The socket to get the family of.
    @type socket: L{socket.socket}

    @rtype: L{int}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/sendmsg.py