def METHOD_NAME(self, dev, src, dir=None):
    pm = ProcMountsParser()
    parts = [x for x in pm.mounts if x.device == dev]
    if parts:
        dst = parts[0].dir
        if src and src != '/': dst = os.path.join(dst, src)
        if not os.path.exists(dst):
            self.log.error("missing SWI: %s", dst)
            return None
        p = dev.find('ubi')
        if p < 0:
            self.check_call(('mount', '-o', 'rw,remount', dst,))
        else:
            self.check_call(('mount', '-t', 'ubifs', '-o', 'rw,remount', dst,))
        return dst
    with MountContext(device=dev, log=self.log) as ctx:
        dst = ctx.dir
        if src and src != '/': dst = os.path.join(dst, src)
        if not os.path.exists(dst):
            self.log.error("missing SWI: %s:%s", dev, src)
            return None
        # move to its proper location as per mtab
        # XXX perms may not be right here
        if dir is not None:
            p = dev.find('ubi')
            if p < 0:
                self.check_call(('mount', '-o', 'rw,remount', ctx.dir,))
            else:
                self.check_call(('mount', '-t', 'ubifs',  '-o', 'rw,remount', ctx.dir,))
            self.check_call(('mount', '--move', ctx.dir, dir,))
            ctx.mounted = False
            dst = dir
            if src and src != '/': dst = os.path.join(dst, src)
            return dst
        ctx.mounted = False
        ctx.hostDir = None
        return dst