import re


def levels_from_strings(
            string_tag,
            level_str='l_',
            node_str = 'n_',
            **kwargs
            ):
    """
    Returns the levels and the node id using the expected strings
    that identify the level id and node id

    :param str level_str: string for the level

    :param str node_str: string for the nodes


    :returns tuple (levels, nodeid):
    """

    positions = [i.start() for i in re.finditer( level_str, string_tag )]
    levels = [string_tag[i+len(level_str)] for i in positions ]
    nodeid_positions = [i.start() for i in re.finditer( node_str, string_tag )]
    nodeid = [string_tag[i+len(node_str)] for i in nodeid_positions ]

    return levels, nodeid