how to get sestion sftp in Paramiko code example

Example: paramiko count file

import paramiko

ip   =  'your remote ip'
username  =  'your user_name'
password  =  'your password'

path = 'your path you want to count file'

ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, username=username, password=password)
sftp = ssh.open_sftp()
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('cd ' + path + ' && ls | wc -l')

print(ssh_stdout.read().decode("utf-8"))