def METHOD_NAME(self, args, skip_sam_metadata=True):
    with tempfile.NamedTemporaryFile(delete=False) as output_template_file_sam:
        sam_command_list = self.get_command_list(output_template_file=output_template_file_sam.name, **args)
        process = Popen(sam_command_list, stdout=PIPE)
        try:
            process.communicate(timeout=TIMEOUT)
        except TimeoutExpired:
            process.kill()
            raise
        self.assertEqual(process.returncode, 0)
        output_sam = output_template_file_sam.read()
    with tempfile.NamedTemporaryFile(delete=False) as output_template_file_aws:
        aws_command_list = self.get_command_list(
            base="aws", output_template_file=output_template_file_aws.name, **args
        )
        process = Popen(aws_command_list, stdout=PIPE)
        try:
            process.communicate(timeout=TIMEOUT)
        except TimeoutExpired:
            process.kill()
            raise
        self.assertEqual(process.returncode, 0)
        output_aws = output_template_file_aws.read()
    # remove the region name from the template url in cases like nested stacks
    output_aws = output_aws.replace(b"s3.us-east-1.", b"s3.")
    if "use_json" in args and args.get("use_json"):
        output_sam = json.loads(output_sam)
        output_aws = json.loads(output_aws)
    else:
        output_sam = yaml_parse(output_sam)
        output_aws = yaml_parse(output_aws)
    if skip_sam_metadata:
        self._remove_sam_related_metadata(output_sam)
    self.assertEqual(output_sam, output_aws)