def _get(obj, name):
    """
    Get the indexable value with given `name` from `obj`, which may be
    a `dict` (or subclass) or a non-dict that has a `__getitem__` method.
    """
    try:
        return dict.__getitem__(obj, name)
    except TypeError:
        if isinstance(obj, dict):
            raise
        return obj[name]
