title: Perform commands over ssh with Python
body: <p>I'm writing a script to automate some command line commands in Python. At the moment, I'm doing calls like this:</p>
  <pre><code>cmd = &quot;some unix command&quot;
  retcode = subprocess.call(cmd,shell=True)
  </code></pre>
  <p>However, I need to run some commands on a remote machine. Manually, I would log in using <code>ssh</code> and then run the commands. How would I automate this in Python? I need to log in with a (known) password to the remote machine, so I can't just use <code>cmd = ssh user@remotehost</code>, I'm wondering if there's a module I should be using?</p>