def METHOD_NAME(pid):
    systemd_cmd = ["systemctl", "--output", "json", "status", str(pid)]
    try:
        systemd_output = subprocess.run(
            systemd_cmd, check=True, text=True, capture_output=True
        )
        status_json = salt.utils.json.find_json(systemd_output.stdout)
    except (ValueError, subprocess.CalledProcessError):
        return None
    name = status_json.get("_SYSTEMD_UNIT")
    if name and name.endswith(".service"):
        return _strip_suffix(name)
    else:
        return None