def nested_dict(k, v):
    """Create a nested dictionary by keys.

    Example
    -------
    `nested_dict(['a','b','c'], 0)` returns `{'a':{'b':{'c':0}}}`.
    """
    if type(k) in {list, tuple}:
        d = {k[-1]: v}
        for q in k[:-1][::-1]:
            d = {q: d}
        return d
    else:
        return {k: v}