def rexists(sftp_client, path):
    """
    Returns true if the remote directory or file under path exists.
    """
    try:
        sftp_client.stat(str(path))
    except IOError as err:
        if err.errno == 2:
            return False
        raise
    else:
        return True