def add_intf_to_map(intf_map, bridge_or_bond, config_type, intf_index, lacp
    =False):
    """Adds an interface to the interface map, after performing validation

    interface_map has a specific structure. this method checks and inserts
    keys if they're missing for the bridge or interface being added.

    :param intf_map: interface map object to which the interface is added
    :param bridge_or_bond: bridge or bond name to which the interface belongs
    :param config_type: type of object - either bridge or bond
    :param intf_index: name or index number of the interface
                       if interface is in nicX format, this will be a
                       numerical index, else name. both would be string.
    :param lacp: boolean flag, specifying whether intf is part of some form of
                 link aggregation or no.
    :return: intf_map after being updated
    """
    if bridge_or_bond not in intf_map:
        intf_map[bridge_or_bond] = {}
    if 'config_type' not in intf_map[bridge_or_bond]:
        intf_map[bridge_or_bond]['config_type'] = config_type
    if 'members' not in intf_map[bridge_or_bond]:
        intf_map[bridge_or_bond]['members'] = []
    if config_type == 'linux_bond' or lacp:
        intf_map[bridge_or_bond]['lacp'] = True
    else:
        intf_map[bridge_or_bond]['lacp'] = False
    intf_map[bridge_or_bond]['members'].append(intf_index)
    return intf_map
