def substitute(message, substitutions=[[], {}], depth=1):
    """
    Substitute `{%x%}` items values provided by substitutions
    :param message: message to be substituted
    :param substitutions: list of list and dictionary. 
        List is used for {%number%} substitutions and dictionary for
        {%name%} substitutions
    :param depth: defines number of pass
    :return: substituted message
    """
    if not isinstance(message, str):
        raise Exception('StringExpected!')

    if depth <1 :
        return message

    new_message = message

    # substitute numbered substitutions
    i = 0
    for value in substitutions[0]:
        new_message = new_message.replace("{%%%d%%}" % i, value)
        i += 1
    # processing named substitutions
    for (k, value) in substitutions[1].items():
        new_message = new_message.replace("{%%%s%%}" % k, value)

    return substitute(new_message, substitutions, depth-1)