def METHOD_NAME(ceph_cluster, osd_id, unmanaged):
    """Sets osd device unmanaged as true/false.
    Args:
        ceph_cluster: ceph cluster
        osd_id: OSD id
        unmanaged: true/false
    """
    config = {
        "command": "apply",
        "service": "osd",
        "verify": False,
    }
    osd = OSD(cluster=ceph_cluster, **config)
    osd_dmns, _ = osd.ps(
        {"base_cmd_args": {"format": "json"}, "args": {"daemon_type": "osd"}}
    )
    # fetch service name using osd.id
    service_name = None
    for daemon in loads(osd_dmns):
        if daemon["daemon_id"] == str(osd_id):
            if daemon.get("service_name") == "osd":
                return
            service_name = daemon["service_name"]
            break
    if not service_name:
        return
    log.info(f"Setting OSD service {service_name} to unmanaged={unmanaged}")
    # fetch OSD service information
    out, err = osd.ls(
        {"base_cmd_args": {"format": "json"}, "args": {"service_name": service_name}}
    )
    # return if no services found
    if "No services reported" in out + err:
        log.warning(out)
        return
    svc = loads(out)[0]
    # return if it is at required state
    if svc.get("unmanaged") == unmanaged:
        log.info(f"{service_name} is already set to unmanaged={unmanaged}")
        return
    # apply to required "unmanaged" state
    svc_spec = {
        "service_type": "osd",
        "service_id": svc["service_id"],
        "unmanaged": unmanaged,
        "spec": svc["spec"],
        "placement": svc["placement"],
    }
    if svc_spec["placement"].get("hosts"):
        svc_spec["placement"]["nodes"] = svc_spec["placement"]["hosts"]
    osd.apply_spec({"specs": [svc_spec]})