def normalize(rendered):
    """Return the input string without non-functional spaces or newlines."""
    out = ''.join([line.strip()
                   for line in rendered.splitlines()
                   if line.strip()])
    out = out.replace(', ', ',')
    return out