I think this should go inside the `if` statement, and power should be validated also for the dimensionless case, like
```
if units[1] is None:
    p = validate_power(args[1])
else:
    p = validate_power(args[1].to(dimensionless_unscaled).value)

result_unit = result_unit ** p
```
or, more concisely,
```
p = validate_power(args[1] if units[1] is None else args[1].to(dimensionless_unscaled).value)
result_unit = result_unit ** p
```