def set_value(dictionary, value, *keys):
    """Modify the value the keys point to in a nested dictionary.

    The dictionary can be a nested dictionary containing lists, these lists can
    also contain nested dictionaries, and so on. The keys list can contain
    strings (which refer dictionary keys) and integers (which refer list
    indices). Dictionary cannot be empty.

    Parameters:
        dictionary (dict): dictionary that contais the key-value pair the user
            wishes to modify.
        value (int, float, string): value to set.
        keys (list): list of keys containing strings and integers.

    Returns:
        dict: modified dictionary.

    Raises:
        TypeError: if type(dictionary) is not ``dict``.

    Example::

        dictionary = {'a':[0,{'b':1},0]}
        value = 2
        keys = ['a', 1, 'b']
        set_value(dictionary, value, *keys) = {'a':[0,{'b':2},0]}

    """

    if not isinstance(dictionary, dict):
        raise TypeError('set_value expects dict as first argument')

    _keys = keys[:-1]
    _element = dictionary
    for key in _keys:
        _element = _element[key]
    _element[keys[-1]] = value

    return dictionary