def _find_basename(self, name, basenames, is_prefix=False):
ret = "<STR_LIT>"<EOL>fileroots = [(os.path.splitext(n)[<NUM_LIT:0>], n) for n in basenames]<EOL>glob = False<EOL>if name.startswith("<STR_LIT:*>"):<EOL><INDENT>glob = True<EOL><DEDENT>name = name.strip("<STR_LIT:*>")<EOL>for fileroot, basename in fileroots:<EOL><INDENT>if name in fileroot or fileroot in name:<EOL><INDENT>for pf in self.module_postfixes:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>'.format(<EOL>basename,<EOL>name,<EOL>pf<EOL>))<EOL>if glob:<EOL><INDENT>if name in fileroot and fileroot.endswith(pf):<EOL><INDENT>ret = basename<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if fileroot.startswith(name) and fileroot.endswith(pf):<EOL><INDENT>ret = basename<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if not ret:<EOL><INDENT>for pf in self.module_prefixes:<EOL><INDENT>n = pf + name<EOL>logger.debug('<STR_LIT>'.format(basename, n))<EOL>if glob:<EOL><INDENT>if fileroot.startswith(pf) and name in fileroot:<EOL><INDENT>ret = basename<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if fileroot.startswith(n):<EOL><INDENT>ret = basename<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not ret:<EOL><INDENT>if is_prefix:<EOL><INDENT>logger.debug('<STR_LIT>'.format(basename, name))<EOL>if basename.startswith(name) or (glob and name in basename):<EOL><INDENT>ret = basename<EOL><DEDENT>else:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>'.format(<EOL>basename,<EOL>name<EOL>))<EOL>if glob:<EOL><INDENT>if name in basename and self._is_module_path(basename):<EOL><INDENT>ret = basename<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if basename.startswith(name) and self._is_module_path(basename):<EOL><INDENT>ret = basename<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if ret:<EOL><INDENT>logger.debug('<STR_LIT>'.format(ret))<EOL>break<EOL><DEDENT><DEDENT><DEDENT>return ret<EOL>
check if name combined with test prefixes or postfixes is found anywhere
        in the list of basenames

        :param name: string, the name you're searching for
        :param basenames: list, a list of basenames to check
        :param is_prefix: bool, True if this is a prefix search, which means it will
            also check if name matches any of the basenames without the prefixes or
            postfixes, if it is False then the prefixes or postfixes must be present
            (ie, the module we're looking for is the actual test module, not the parent
             modules it's contained in)
        :returns: string, the basename if it is found