def establish_ssh_connection(ip,<EOL>ssh_private_key_file,<EOL>ssh_user,<EOL>port,<EOL>attempts=<NUM_LIT:5>,<EOL>timeout=None):
client = paramiko.SSHClient()<EOL>client.set_missing_host_key_policy(paramiko.AutoAddPolicy())<EOL>while attempts:<EOL><INDENT>try:<EOL><INDENT>client.connect(<EOL>ip,<EOL>port=port,<EOL>username=ssh_user,<EOL>key_filename=ssh_private_key_file,<EOL>timeout=timeout<EOL>)<EOL><DEDENT>except:  <EOL><INDENT>attempts -= <NUM_LIT:1><EOL>time.sleep(<NUM_LIT:10>)<EOL><DEDENT>else:<EOL><INDENT>return client<EOL><DEDENT><DEDENT>raise IpaSSHException(<EOL>'<STR_LIT>'<EOL>)<EOL>
Establish ssh connection and return paramiko client.

Raises:
    IpaSSHException: If connection cannot be established
        in given number of attempts.