import re


def normalize_whitespace(content):
    """Strips trailing and leading whitespace from each line, and normalizes contiguous
    whitespace with a single space.
    """
    return [re.sub(r'\s+', ' ', line.strip()) for line in content.strip().split('\n')]