def _is_bare_mapping(o):
    """Whether the object supports __getitem__ and __contains__"""
    return (
        hasattr(o, '__contains__') and callable(o.__contains__) and
        hasattr(o, '__getitem__') and callable(o.__getitem__)
    )