import re


def check_output(want, got, normelize=True):
    """
    Return True iff the actual output from an example (`got`)
    matches the expected output (`want`).
    If True the second return is
    0 perfect fit
    1 no lines reduced to spaces
    2 Normalization of spaces ( \s* -> \s )
    3 No Spaces in comparaison

    >>> check_output("éeè ","   \\néeè ".encode("utf-8"))
    (True, 1)
    >>> check_output("é  e  è  \\n     ","é e è  ".encode("utf-8"))
    (True, 2)
    >>> check_output("é  e \t è \\n  ","éeè")
    (True, 3)
    """
    
    if type(got) == type(b'r'):
        got = got.decode("utf-8")
    if type(want) == type(b'r'):
        want = want.decode("utf-8")
    if got == want:
        return True, 0
    
    # If a line in got contains only spaces, then remove the
    # spaces.
    got = re.sub('(?m)^\s*?$', '', got)
    print(got)
    if got == want:
        return True, 1
    # This flag causes doctest to ignore any differences in the
    # contents of whitespace strings.  Note that this can be used
    # in conjunction with the ELLIPSIS flag.
    if normelize:  # we want normelized white spaces
        got = ' '.join(got.split())
        want = ' '.join(want.split())
        if got == want:
            return True, 2
    # We didn't find any match; return false.
    if True:  # no white spaces
        got = ''.join(got.split())
        want = ''.join(want.split())
        if got == want:
            return True, 3
    return False, -1