def METHOD_NAME(self, builder, source):
    try:
        return builder.build(source)
    except DataError:
        # Possible resource file in PYTHONPATH. Something like `xxx.resource` that
        # did not exist has been considered to be a library earlier, now we try to
        # parse it as a resource file.
        if (isinstance(builder, LibraryDocBuilder)
                and not os.path.exists(source)
                and self._get_extension(source) in RESOURCE_EXTENSIONS):
            return self.METHOD_NAME(ResourceDocBuilder(), source)
        # Resource file with other extension than '.resource' parsed as a suite file.
        if isinstance(builder, SuiteDocBuilder):
            return self.METHOD_NAME(ResourceDocBuilder(), source)
        raise
    except Exception:
        raise DataError(f"Building library '{source}' failed: {get_error_message()}")