def update_component(name, comp, component_dict):
    """Get a component from a component dict.

    """
    for dia in component_dict.get('dialogues', ()):
        try:
            comp.add_dialogue(*_get_pair(dia))
        except Exception as e:
            msg = 'In device %s, malformed dialogue %s\n%r'
            raise Exception(msg % (name, dia, e))

    for prop_name, prop_dict in component_dict.get('properties', {}).items():
        try:
            getter = (_get_pair(prop_dict['getter'])
                      if 'getter' in prop_dict else None)
            setter = (_get_triplet(prop_dict['setter'])
                      if 'setter' in prop_dict else None)
            comp.add_property(prop_name, prop_dict.get('default', ''),
                              getter, setter, prop_dict.get('specs', {}))
        except Exception as e:
            msg = 'In device %s, malformed property %s\n%r'
            raise type(e)(msg % (name, prop_name, format_exc()))
Get a component from a component dict.