import textwrap


def ftl(code):
    """Nicer indentation for FTL code.

    The code returned by this function is meant to be compared against the
    output of the FTL Serializer.  The input code will be UTF8-decoded and will
    end with a newline to match the output of the serializer.
    """

    # The FTL Serializer returns Unicode data so we use it as the baseline.
    code = code.decode('utf8')

    # The code might be triple-quoted.
    code = code.lstrip('\n')

    return textwrap.dedent(code)