import re


def _get_dict_value(d, keys):
    """Get dictionary value from nested dictionary keys."""
    if isinstance(keys, str):  # no nesting
        return d[keys]
    value = d
    for key in keys:
        if match := re.search(r"\[(\d+)\]", key):  # list element
            value = value[int(match.group(1))]
        else:  # dict element
            value = value[key]
    return value