You could have a problem here eventually if prefix has any regex-special characters in it.  It doesn't look like the calls today have any, though.  If you want, re.escape(prefix) would fix it up.