<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, pcap):
 """ Runs suricata against the supplied pcap. :param pcap: Filepath to pcap file to scan :returns: tuple of version, list of alerts """

        tmpdir = None
        try:
            tmpdir = tempfile.mkdtemp(prefix='tmpsuri')
            proc = Popen(self._suri_cmd(pcap, tmpdir), stdout=PIPE,
                     stderr=PIPE, universal_newlines=True)
            stdout, stderr = proc.communicate()
            if proc.returncode != 0:
                raise Exception("\n".join(["Execution failed return code: {0}" \
                                .format(proc.returncode), stderr or ""]))

            with open(os.path.join(tmpdir, 'fast.log')) as tmp:
                return (parse_version(stdout),
                    [ x for x in parse_alert(tmp.read()) ])
        finally:
            if tmpdir:
                shutil.rmtree(tmpdir)