def _safe_get(_document, _key):
    """Prevent generic KeyError exceptions"""
    if _key not in _document:
        raise KeyError(f'bcl stats file is missing {_key} attribute')
    else:
        return _document[_key]