def METHOD_NAME(self, env: BuildEnvironment, imgpath: str,
                       candidates: dict[str, str], node: Node) -> None:
    globbed: dict[str, list[str]] = {}
    for filename in glob(imgpath):
        new_imgpath = relative_path(path.join(env.srcdir, 'dummy'),
                                    filename)
        try:
            mimetype = guess_mimetype(filename)
            if mimetype is None:
                basename, suffix = path.splitext(filename)
                mimetype = 'image/x-' + suffix[1:]
            if mimetype not in candidates:
                globbed.setdefault(mimetype, []).append(new_imgpath)
        except OSError as err:
            logger.warning(__('image file %s not readable: %s') % (filename, err),
                           location=node, type='image', subtype='not_readable')
    for key, files in globbed.items():
        candidates[key] = sorted(files, key=len)[0]  # select by similarity