def rexists(sftp, path):
    """os.path.exists for paramiko's SCP object
    """
try:
    sftp.stat(path)
except IOError as e:
    if e[0] == 2:
        return False
raise
Check whether a path exists on a remote host using paramiko