human
I wrote the below code

    def _exponents_(expr, x, res):
        if (expr == x):
            res.update([1])
            return
        if (expr.is_Pow and (expr.base == x)):
            res.update([expr.exp])
            return
        for arg in expr.args:
            _exponents_(arg, x, res)
    res = set()
    _exponents_(expr, x, res)
    return res

What's a good function header?
assistant
#Here's a good function header.

def _exponents(expr, x):