def unthe(self, text, pattern):
        if text:
            r = re.compile(pattern, flags=re.IGNORECASE)
            try:
                t = r.findall(text)[0]
            except IndexError:
                return text
            else:
                r = re.sub(r, '', text).strip()
                if self.config['strip']:
                    return r
                else:
                    fmt = self.config['format'].get(unicode)
                    return fmt.format(r, t.strip()).strip()
        else:
            return u''
Moves pattern in the path format string or strips it
dataset/ETHPy150Open beetbox/beets/beetsplug/the.py/ThePlugin.unthe