def METHOD_NAME(frame,bitmask=None,ivar_framemask=True,return_mask=False):
    """
    Function that takes a frame object and a bitmask and
    returns ivar (and optionally mask) array(s) that have fibers with
    offending bits in fibermap['FIBERSTATUS'] set to
    0 in ivar and optionally flips a bit in mask.
    Args:
        frame: frame object
        bitmask: int32 or list/array of int32's derived from desispec.maskbits.fibermask
            OR string indicating a keyword for get_fiberbitmask_comparison_value()
        ivar_framemask: bool (default=True), tells code whether to multiply the output
            variance by (frame.mask==0)
        return_mask: bool, (default=False). Returns the frame.mask with the logic of
            FIBERSTATUS applied.
    Returns:
        ivar: frame.ivar where the fibers with FIBERSTATUS & bitmask > 0
            set to zero ivar
        mask: (optional) frame.mask logically OR'ed with BADFIBER bit in cases with
            a bad FIBERSTATUS
    Examples:
        Example bitmask list::
            bitmask = [fmsk.BROKENFIBER,fmsk.UNASSIGNED,fmsk.BADFIBER,\
                        fmsk.BADTRACE,fmsk.MANYBADCOL, fmsk.MANYREJECTED]
            bitmask = get_fiberbitmask_comparison_value(kind='fluxcalib', band='brz')
            bitmask = 'fluxcalib'
            bitmask = 4128780
    """
    ivar = frame.ivar.copy()
    mask = frame.mask.copy()
    if ivar_framemask and frame.mask is not None:
        ivar *= (frame.mask==0)
    fmap = Table(frame.fibermap)
    if frame.fibermap is None:
        log = get_logger()
        log.warning("No fibermap was given, so no FIBERSTATUS check applied.")
    if bitmask is None or frame.fibermap is None:
        if return_mask:
            return ivar, mask
        else:
            return ivar
    if type(bitmask) in [int,np.int32]:
        bad = bitmask
    elif type(bitmask) == str:
        if bitmask.isnumeric():
            bad = np.int32(bitmask)
        else:
            band = 'brz' # all by default
            if frame.meta is not None :
                if "CAMERA" in frame.meta.keys() :
                    camera = frame.meta["CAMERA"].lower()
                    band   = camera[0]
            bad    = get_fiberbitmask_comparison_value(kind=bitmask,band=band)
    else:
        bad = bitmask[0]
        for bit in bitmask[1:]:
            bad |= bit
    # find if any fibers have an intersection with the bad bits
    badfibers = (fmap['FIBERSTATUS'] & bad) > 0
    # For the bad fibers, loop through and nullify them
    for i in np.where(badfibers)[0]:
        mask[i] |= specmask.BADFIBER
        if ivar_framemask :
            ivar[i] = 0.
    if return_mask:
        return ivar,mask
    else:
        return ivar