<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self, cmd, timeout=None, key=None):
 """ Run a command on the phablet device using ssh :param cmd: a list of strings to execute as a command :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh key to use for connection :returns: the exit code of the command This method will not allow you to capture stdout/stderr from the target process. If you wish to do that please consider switching to one of subprocess functions along with. :meth:`cmdline()`. """

        if not isinstance(cmd, list):
            raise TypeError("cmd needs to be a list")
        if not all(isinstance(item, str) for item in cmd):
            raise TypeError("cmd needs to be a list of strings")
        self.connect(timeout, key)
        return self._run_ssh(cmd)