Helper method to return a dictionary of tuples. Each key is attr_name, and value is (attr_type, attr_is_optional)

    :param item_type:
    :return:

def get_attrs_declarations(item_type):
    """
    Helper method to return a dictionary of tuples. Each key is attr_name, and value is (attr_type, attr_is_optional)

    :param item_type:
    :return:
    """

    # this will raise an error if the type is not an attr-created type
    attribs = fields(item_type)

    res = dict()
    for attr in attribs:
        attr_name = attr.name

        # -- is the attribute mandatory ?
        optional = is_optional(attr)

        # -- get and check the attribute type
        typ = guess_type_from_validators(attr)

        # -- store both info in result dict
        res[attr_name] = (typ, optional)

    return res