import re


def filter_lines(output, filter_string):
    """Output filter from build_utils.check_output.

    Args:
      output: Executable output as from build_utils.check_output.
      filter_string: An RE string that will filter (remove) matching
          lines from |output|.

    Returns:
      The filtered output, as a single string.
    """
    re_filter = re.compile(filter_string)
    return '\n'.join(
        line for line in output.splitlines() if not re_filter.search(line))