def METHOD_NAME(gorule: Dict) -> str:
    impls = gorule.get("implementations", [])
    if impls is None:
        # This extra if is required because valid files can be interpreted as having
        # None as an implementations mapping. If we think it's none, there is no sparql
        # so just escape with empty string
        return ""
    sparql = ""
    for impl in impls:
        if impl["language"] == "sparql":
            return impl["code"]
    return ""