def METHOD_NAME(cls, filename, subject, xfmname, **kwargs):
    print('Caching mapper...')
    from ..database import db
    masks = []
    xfm = db.get_xfm(subject, xfmname, xfmtype='coord')
    fid = db.get_surf(subject, 'fiducial', merge=False, nudge=False)
    try:
        flat = db.get_surf(subject, 'flat', merge=False, nudge=False)
    except IOError:
        flat = fid
    for (pts, _), (_, polys) in zip(fid, flat):
        masks.append(cls._getmask(xfm(pts), polys, xfm.shape, **kwargs))
    _savecache(filename, masks[0], masks[1], xfm.shape)
    return cls(masks[0], masks[1], xfm.shape, subject, xfmname)