It would be simpler to use sets here:
```python
expected = set(expected_keys)
actual = set(dictionary.keys())
missing = expected - actual
if not missing:
    return True
if raise_error:
    # decide how you want to format this error message, since you now know
    # *all* of the missing keys
else:
    return False
```