from typing import Union


def _get_set_item_type(attr_spec):
    """
    Get the type(s) of items for set method signatures.
    """
    item_type = attr_spec.item_type
    if attr_spec.item_spec_key_type:
        item_type = Union[
            attr_spec.item_spec_key_type,
            item_type,
        ]
    return item_type