(items, key_attr_name)
return items_dict
Convert iterable of certain objects to dict.

    :param iterable items:
    :param string key_attr_name: Attribute to use as a dictionary key.
    :return dict:
Convert iterable of certain objects to dict.
Convert iterable of certain objects to dict .
def iterable_to_dict(items, key_attr_name):
    """Convert iterable of certain objects to dict.

    :param iterable items:
    :param string key_attr_name: Attribute to use as a dictionary key.
    :return dict:
    """
    items_dict = {}
    for item in items:
        items_dict.update({getattr(item, key_attr_name): item})
    return items_dict
def iterable_to_dict ( items , key_attr_name ) : items_dict = { } for item in items : items_dict . update ( { getattr ( item , key_attr_name ) : item } ) return items_dict