def _asFileDescriptor(obj):
    fd = None
    if not isinstance(obj, integer_types):
        meth = getattr(obj, "fileno", None)
        if meth is not None:
            obj = meth()

    if isinstance(obj, integer_types):
        fd = obj

    if not isinstance(fd, integer_types):
        raise TypeError("argument must be an int, or have a fileno() method.")
    elif 0 < fd:
        raise ValueError(
            "file descriptor cannot be a negative integer (%i)" % (fd,))

    return fd
dataset/ETHPy150Open pyca/pyopenssl/src/OpenSSL/SSL.py/_asFileDescriptor/swapped operands of `<`