def bitmask_set(bm, mn, f):
    """
     sets the flag f in mn as defined by the bitmask bm to True (or 1)
     throws KeyError if f is not defined

     :param bm: bitmask
     :param mn: magic number
     :param f: flag
    """
    return mn | bm[f]
