Port extract-bands to Python