import json


def get_host_osd_map(cls):
    """
    Method to get the OSDs deployed in each of the hosts
    Args:
        cls: cephadm instance object

    Returns:
        Dictionary with host names as keys and osds deployed as value list
    """
    out, _ = cls.shell(args=["ceph", "osd", "tree", "-f", "json"])
    osd_obj = json.loads(out)
    osd_dict = {}
    for obj in osd_obj["nodes"]:
        if obj["type"] == "host":
            osd_dict[obj["name"]] = obj["children"]
    return osd_dict