<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def action(self, includes: dict, variables: dict) -> tuple: """ Call external script. :param includes: testcase's includes :param variables: variables :return: script's output """

        json_args = fill_template_str(json.dumps(self.data), variables)
        p = subprocess.Popen([self.module, json_args], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        if p.wait() == 0:
            out = p.stdout.read().decode()
            debug(out)
            return variables, json.loads(out)
        else:
            out = p.stdout.read().decode()
            warning(out)
            raise Exception('Execution failed.')