Text this: A generalization of the Gauss–Bonnet–Hopf–Poincaré formula for sections and branched sections of bundles