def limit_text_to_be_path_element(text, max_length=None, separator='_'):
    """ Replace characters that are not in the valid character set of RAFCON.

    :param text: the string to be cleaned
    :param max_length: the maximum length of the output string
    :param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length
    :return:
    """
    # TODO: Should there not only be one method i.e. either this one or "clean_path_element"
    elements_to_replace = {' ': '_', '*': '_'}
    for elem, replace_with in elements_to_replace.items():
        text = text.replace(elem, replace_with)
    text = re.sub('[^a-zA-Z0-9-_]', '', text)
    if max_length is not None:
        text = limit_text_max_length(text, max_length, separator)
    return text
Replace characters that are not in the valid character set of RAFCON.

    :param text: the string to be cleaned
    :param max_length: the maximum length of the output string
    :param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length
    :return: