Text this: General mass treatment for Z boson production in association with a heavy quark at hadron colliders