async def METHOD_NAME(
    classpath: Classpath, shading_rules: Iterable[JvmShadingRule] | None
) -> Digest:
    input_digest = await Get(Digest, MergeDigests(classpath.digests()))
    if not shading_rules:
        return input_digest
    jars_digest = await Get(Digest, DigestSubset(input_digest, PathGlobs(["**/*.jar"])))
    digest_entries = await Get(DigestEntries, Digest, jars_digest)
    jar_entries = [entry for entry in digest_entries if isinstance(entry, FileEntry)]
    if len(jar_entries) == 0:
        return EMPTY_DIGEST
    jar_digests = await MultiGet(Get(Digest, CreateDigest([entry])) for entry in jar_entries)
    shaded_jars = await MultiGet(
        Get(ShadedJar, ShadeJarRequest(path=entry.path, digest=digest, rules=shading_rules))
        for entry, digest in zip(jar_entries, jar_digests)
    )
    return await Get(Digest, MergeDigests([shaded.digest for shaded in shaded_jars]))