def convert_dialogue(dialogue_data):
    """
    Reads and converts the data from an Dialogue data set.
    DisplayName will be already lowered here and empty spaces replaced by "_"
    Returns a dictionary with only the data set we need for the converter to work.

    (Id, Type, DisplayName, Parent, Text, "StartNode", "EndNode)
    """
    properties = dialogue_data["Properties"]
    display_name = properties["DisplayName"].lower().strip().replace(" ", "_")
    # Get the first connection of the input pin as our start node
    # Therefore a Dialogue should always have just one node at the start!

    start_node = properties["InputPins"][0]["Connections"][0]["Target"]

    # Check if the output pin of the node is connected to a label
    if "Connections" in properties["OutputPins"][0]:
        end_node = properties["OutputPins"][0]["Connections"][0]["Target"]
    else:
        end_node = None

    dialogue_element = {"Id": properties["Id"],
                        "Type": dialogue_data["Type"],
                        "DisplayName": display_name,
                        "Parent": properties["Parent"],
                        "Text": properties["Text"].replace("\r", "").replace("\n\n", "\n").split("\n"),
                        "StartNode": start_node,
                        "EndNode": end_node}
    return dialogue_element