def format_html(input):  # pylint: disable=redefined-builtin
    """Render formatted HTML code by removing empty lines and spaces ending lines

    >>> from pyams_utils.testing import format_html
    >>> format_html('''<div>      \\n<b>This is a test</b>    \\n\\n</div>    ''')
    '<div>\\n<b>This is a test</b>\\n</div>'
    """
    return '\n'.join(filter(bool, map(str.rstrip, input.split('\n'))))