def errno_from_exception(e):

    if hasattr(e, 'errno'):
        return e.errno
    elif e.args:
        return e.args[0]
    else:
        return None


# from tornado
Provides the errno from an Exception object.
dataset/ETHPy150Open ziggear/shadowsocks/shadowsocks/eventloop.py/errno_from_exception