Updating generic.py error message

This is my first attempt at a PR. I just made a little change to allow an error message. Would appreciate some feedback. 
Based on https://github.com/pydata/pandas/issues/8015
I am not fully sure, but something like just checking that at least level or by is specified:
```
if level is None and by is None:
    raise TypeError('You have to specify at least one of "by" or "level"')
```
and then just proceed with how it was original?