def replaceCodes(text=""):
    """
    Helper function that does the ``\\n`` and space substition
    returning the changed text.
    """
    text = text.replace('\n', '<br>')
    text = text.replace('\t', ' ' * 4)
    text = text.replace(" " * 4, "&nbsp; &nbsp; ")
    text = text.replace(" " * 3, "&nbsp; &nbsp;")
    text = text.replace(" " * 2, "&nbsp; ")
    text = text.replace("<br><br>", "<br> <br>")
    return text