i made a mistake when i called client.connect() with username option:
before:
client.connect(host, username, key_filename=os.path.join(os.path.expanduser('~'), ".ssh",private_key_file))
after:
client.connect(host, username=username, key_filename=os.path.join(os.path.expanduser('~'), ".ssh",private_key_file))