def get_nested_dict(dd, flatkey, sep=':', prefix='distgen'):
    """
    Gets the value in a nested dict from a flattened key.
    See: flatten_dict
    """
    if flatkey.startswith(prefix+sep):
        flatkey=flatkey[len(prefix+sep):]
    keys = flatkey.split(':')
    d = dd
    # Go through nested dicts
    for k in keys:
        d = d[k]
    return d