def key_from_slice(k, s):
    """Take a slice s of the key k."""
    if not isinstance(k, tuple):
        k = k,
    ans = []
    for i in range(len(s)):
        if isinstance(s[i], slice):
            ans.append(k[i])
    if len(ans) > 1:
        return tuple(ans)
    else:
        return ans[0]
