def _filter_tag(input_xml, tag):
    """Filter out the script so we can parse the xml."""
    output_lines = []
    inside = False
    for line in input_xml.splitlines():
        if '<{tag}>'.format(tag=tag) in line:
            inside = True
        if not inside:
            output_lines.append(line)
        if '</{tag}>'.format(tag=tag) in line:
            inside = False
    return '\n'.join(output_lines)
