def METHOD_NAME(purl):
    """Generate compatible payload for OSV API from a PURL"""
    supported_ecosystem = OSVDataSource.supported_ecosystem()
    payload = {}
    payload["version"] = purl.version
    package = payload["package"] = {}
    purl_type = purl.type
    purl_namespace = purl.namespace
    if purl_type in supported_ecosystem:
        package["ecosystem"] = supported_ecosystem[purl_type]
    if purl_type == "maven":
        if not purl_namespace:
            logger.error(f"Invalid Maven PURL {str(purl)}")
            return
        package["name"] = f"{purl.namespace}:{purl.name}"
    elif purl_type == "packagist":
        if not purl_namespace:
            logger.error(f"Invalid Packagist PURL {str(purl)}")
            return
        package["name"] = f"{purl.namespace}/{purl.name}"
    elif purl_type == "linux":
        if purl.name not in ("kernel", "Kernel"):
            logger.error(f"Invalid Linux PURL {str(purl)}")
            return
        package["name"] = "Kernel"
    elif purl_type == "nuget":
        nuget_package = search_closest_nuget_package_name(purl.name)
        if not nuget_package:
            logger.error(f"Invalid NuGet PURL {str(purl)}")
            return
        package["name"] = nuget_package
    elif purl_type == "golang" and purl_namespace:
        package["name"] = f"{purl.namespace}/{purl.name}"
    else:
        package["name"] = purl.name
    return payload