import re


def generateLayer2(dialogue):
    """Generates a second layer for each dialogue event, with identical text and timestamp

    Args:
        dialogue (string): The layer 1 line of dialogue taken from the original Aegisub file

    Returns:
        string: The original layer 1 line of dialogue with the layer 2 line of dialogue appended to it
    """
    dialogue = dialogue.rstrip()
    layer2 = dialogue
    layer2 = layer2.replace("Dialogue: 1,", "Dialogue: 2,")
    layer2 = re.sub(r'\{.*(\\pos.+\)).+\}', r'{\1}', layer2)
    return dialogue + '\n' + layer2 + '\n'