def map_components_by_name(components):
    """Given a dictionary or list of components, map them into a dictionary by name"""
    if isinstance(components, dict):
        components = components.values()
    return {
        component.name: component
        for component in components
    }