>>> d = dict(a=1, b=2, c=3)
    >>> print(json.dumps(select_keys(d, 'a c'), sort_keys=True))
    {"a": 1, "c": 3}
    >>> select_keys(d, 'a d')
    Traceback (most recent call last):
    ...
    KeyError: "Tried to access 'd', only keys are: ['a', 'b', 'c']"
    >>> select_keys(d, 'a d', helpful_error=False)
    Traceback (most recent call last):
    ...
    KeyError: 'd'

def select_keys(d, keys, helpful_error=True):
    """
    >>> d = dict(a=1, b=2, c=3)
    >>> print(json.dumps(select_keys(d, 'a c'), sort_keys=True))
    {"a": 1, "c": 3}
    >>> select_keys(d, 'a d')
    Traceback (most recent call last):
    ...
    KeyError: "Tried to access 'd', only keys are: ['a', 'b', 'c']"
    >>> select_keys(d, 'a d', helpful_error=False)
    Traceback (most recent call last):
    ...
    KeyError: 'd'
    """
    keys = ensure_list_if_string(keys)
    if helpful_error:
        return {k: helpful_error_dict_get(d, k) for k in keys}
    else:
        return {k: d[k] for k in keys}