def METHOD_NAME(operations, ranges, entity_map, entity):
    """Prepare operations dict defining operations on specific indexes.
    Data format:
        - key: index value
        - value: list of html elements that should be insert into text on specific index
    """
    for range_date in ranges:
        tag = "a" if entity else TAG_MAPPING[range_date["style"]]
        offset = range_date["offset"]
        length = offset + range_date["length"] - 1
        if entity:
            entity_key = str(range_date["key"])
            href = entity_map[entity_key]["data"]["url"]
            start_tag = f'{tag} href="{href}"'
        else:
            start_tag = tag if tag != "code" else tag + ' class="inline-code"'
        operations[offset - 1].append(f"<{start_tag}>")
        operations[length] = [f"</{tag}>"] + operations[length]