can bw be a scalar?
then reversing the check to test for isinstance string as in the other calculate_bw would be better.