def get_errno(e):
    """
    Return the errno of an exception, or the first argument if errno is not available.

    :param e: the exception object
    """
    try:
        return e.errno
    except AttributeError:
        return e.args[0]