def deep_get(dikt, path):
    """Get a value or values located in `path` from a nested dictionary.
    Use a string separated by periods as the path to access
    values in a nested dictionary:
    deep_get(data, "data.files.0") == data["data"]["files"][0]
    deep_get(data, "data.files") == data["data"]["files"][]
    """
    value = dikt
    for component in path.split('.'):
        if component.isdigit():
            value = value[int(component)]
        elif type(value) == list:
            new = []
            for v in value:
                if component in v:
                    new.append(v[component])
            value = new
        elif component in value:
            value = value[component]
    return value
